[SERVER-30711] Mongo build failure [-Werror=noexcept-type] Created: 17/Aug/17  Updated: 30/Oct/23  Resolved: 11/Jan/19

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 4.1.7

Type: Bug Priority: Minor - P4
Reporter: Josef Ahmad Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: former-toolchain-epic
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
is duplicated by SERVER-32031 Scons Install Fails with Errors Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Check out the tip of master (reproduced on commit 1158a6b9b1)
Build all with gcc 7.1

$ python2 buildscripts/scons.py all

Sprint: Build 2019-01-14
Participants:

 Description   

$ uname -a
Linux localhost.localdomain 4.11.8-300.fc26.x86_64 #1 SMP Thu Jun 29 20:09:48 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
 
$ gcc --version
gcc (GCC) 7.1.1 20170622 (Red Hat 7.1.1-3)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
$ git describe
r3.5.11-206-g1158a6b9b1
 
$ python2 buildscripts/scons.py all -j 2
[cut]
Compiling build/opt/mongo/platform/stack_locator_linux.o
In file included from src/mongo/platform/stack_locator_pthread_getattr_np.cpp:36:0,
                 from src/mongo/platform/stack_locator_linux.cpp:29:
src/mongo/util/scopeguard.h: In instantiation of 'mongo::ScopeGuardImpl1<F, P1> mongo::MakeGuard(F, P1) [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]':
src/mongo/platform/stack_locator_pthread_getattr_np.cpp:45:51:   required from here
src/mongo/util/scopeguard.h:154:7: error: mangled name for 'mongo::ScopeGuardImpl1<int (*)(pthread_attr_t*) throw (), pthread_attr_t*>::ScopeGuardImpl1(const mongo::ScopeGuardImpl1<int (*)(pthread_attr_t*) throw (), pthread_attr_t*>&)' will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
 class ScopeGuardImpl1 : public ScopeGuardImplBase {
       ^~~~~~~~~~~~~~~
src/mongo/util/scopeguard.h:154:7: error: mangled name for 'mongo::ScopeGuardImpl1<int (*)(pthread_attr_t*) throw (), pthread_attr_t*>::ScopeGuardImpl1(const mongo::ScopeGuardImpl1<int (*)(pthread_attr_t*) throw (), pthread_attr_t*>&)' will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
src/mongo/util/scopeguard.h:177:53: note: synthesized method 'mongo::ScopeGuardImpl1<int (*)(pthread_attr_t*) throw (), pthread_attr_t*>::ScopeGuardImpl1(const mongo::ScopeGuardImpl1<int (*)(pthread_attr_t*) throw (), pthread_attr_t*>&)' first required here
     return ScopeGuardImpl1<F, P1>::MakeGuard(fun, p1);
                                                     ^
src/mongo/util/scopeguard.h: In instantiation of 'mongo::ScopeGuardImpl1<F, P1>::~ScopeGuardImpl1() [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]':
src/mongo/platform/stack_locator_pthread_getattr_np.cpp:45:51:   required from here
src/mongo/util/scopeguard.h:160:5: error: mangled name for 'mongo::ScopeGuardImpl1<F, P1>::~ScopeGuardImpl1() [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]' will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
     ~ScopeGuardImpl1() throw() {
     ^
src/mongo/util/scopeguard.h:160:5: error: mangled name for 'mongo::ScopeGuardImpl1<F, P1>::~ScopeGuardImpl1() [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]' will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
src/mongo/util/scopeguard.h: In instantiation of 'mongo::ScopeGuardImpl1<F, P1>::ScopeGuardImpl1(F, P1) [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]':
src/mongo/util/scopeguard.h:157:16:   required from 'static mongo::ScopeGuardImpl1<F, P1> mongo::ScopeGuardImpl1<F, P1>::MakeGuard(F, P1) [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]'
src/mongo/util/scopeguard.h:177:45:   required from 'mongo::ScopeGuardImpl1<F, P1> mongo::MakeGuard(F, P1) [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]'
src/mongo/platform/stack_locator_pthread_getattr_np.cpp:45:51:   required from here
src/mongo/util/scopeguard.h:169:5: error: mangled name for 'mongo::ScopeGuardImpl1<F, P1>::ScopeGuardImpl1(F, P1) [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]' will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
     ScopeGuardImpl1(F fun, P1 p1) : fun_(fun), p1_(p1) {}
     ^~~~~~~~~~~~~~~
src/mongo/util/scopeguard.h:169:5: error: mangled name for 'mongo::ScopeGuardImpl1<F, P1>::ScopeGuardImpl1(F, P1) [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]' will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
src/mongo/util/scopeguard.h:164:10: error: mangled name for 'void mongo::ScopeGuardImpl1<F, P1>::Execute() [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]' will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
     void Execute() {
          ^~~~~~~
src/mongo/util/scopeguard.h:169:5: error: mangled name for 'mongo::ScopeGuardImpl1<F, P1>::ScopeGuardImpl1(F, P1) [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]' will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
     ScopeGuardImpl1(F fun, P1 p1) : fun_(fun), p1_(p1) {}
     ^~~~~~~~~~~~~~~
src/mongo/util/scopeguard.h:96:17: error: mangled name for 'static void mongo::ScopeGuardImplBase::SafeExecute(J&) [with J = mongo::ScopeGuardImpl1<int (*)(pthread_attr_t*) throw (), pthread_attr_t*>]' will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
     static void SafeExecute(J& j) throw() {
                 ^~~~~~~~~~~
src/mongo/util/scopeguard.h:156:35: error: mangled name for 'static mongo::ScopeGuardImpl1<F, P1> mongo::ScopeGuardImpl1<F, P1>::MakeGuard(F, P1) [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]' will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
     static ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1) {
                                   ^~~~~~~~~
src/mongo/util/scopeguard.h:160:5: error: mangled name for 'mongo::ScopeGuardImpl1<F, P1>::~ScopeGuardImpl1() [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]' will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
     ~ScopeGuardImpl1() throw() {
     ^
src/mongo/util/scopeguard.h:176:31: error: mangled name for 'mongo::ScopeGuardImpl1<F, P1> mongo::MakeGuard(F, P1) [with F = int (*)(pthread_attr_t*) throw (); P1 = pthread_attr_t*]' will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
 inline ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1) {
                               ^~~~~~~~~
src/mongo/util/scopeguard.h:154:7: error: mangled name for 'mongo::ScopeGuardImpl1<int (*)(pthread_attr_t*) throw (), pthread_attr_t*>::ScopeGuardImpl1(const mongo::ScopeGuardImpl1<int (*)(pthread_attr_t*) throw (), pthread_attr_t*>&)' will change in C++17 because the exception specification is part of a function type [-Werror=noexcept-type]
 class ScopeGuardImpl1 : public ScopeGuardImplBase {
       ^~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
scons: *** [build/opt/mongo/platform/stack_locator_linux.o] Error 1
scons: building terminated because of errors.
build/opt/mongo/platform/stack_locator_linux.o failed: Error 1



 Comments   
Comment by Githook User [ 11/Jan/19 ]

Author:

{'email': 'ian.boros@10gen.com', 'name': 'Ian Boros'}

Message: SERVER-30711 fix compile
Branch: master
https://github.com/mongodb/mongo/commit/ac226ba03ff30583d7108c8d13edabb6ebf5a621

Comment by Githook User [ 11/Jan/19 ]

Author:

{'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com', 'name': 'Billy Donahue'}

Message: SERVER-30711: scope_guard rewrite, to avoid -Werror=noexcept-type

Macro ON_BLOCK_EXIT(...) now takes a single callable,

Some renames:
Dismias -> dismiss
MakeGuard => makeGuard
Branch: master
https://github.com/mongodb/mongo/commit/bbf28648de0d8695c502e13922a8d9e5ca1b51e8

Comment by Githook User [ 11/Jan/19 ]

Author:

{'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com', 'name': 'Billy Donahue'}

Message: SERVER-30711: -Werror=noexcept-type, ScopeGuard changes
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/0db451cf14b7f38491e43a03b9cae169a2297801

Comment by Billy Donahue [ 10/Jan/19 ]

the enterprise side:
https://mongodbcr.appspot.com/240250001/

Comment by Andrew Morrow (Inactive) [ 17/Aug/17 ]

The --Wall flag for GCC 7 apparently also includes warnings for C++17 compatibility. Since we haven't qualified that compiler, it isn't too surprising that it throws warnings on our code. However, we also build with --Werror, so those warnings become errors. In this case, the warning is harmless. You can downgrade it again to a warning by building with --disable-warnings-as-errors.

Generated at Thu Feb 08 04:24:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.