[CDRIVER-1179] --enable-maintainer-flags doesn't add -Wdeclaration-after-statement Created: 25/Mar/16 Updated: 10/Aug/16 Resolved: 09/May/16 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | 1.4.0 |
| Fix Version/s: | 1.4.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Hannes Magnusson | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
VS2010 isn't a fan of variable declarations after statements, so requires them to be declared at the start of a scope. For that, we have -Wdeclaration-after-statement as part of our --enable-maintainer-flags both in libbson and mongoc. Unfortunately, this flag makes no sense in C++ where this is completely valid. |
| Comments |
| Comment by Githook User [ 09/May/16 ] | ||||||||
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}Message: In ./autogen.sh --enable-maintainer-flags, for some reason we check if We don't use g+, so don't check flags for g+ compatibility. | ||||||||
| Comment by Githook User [ 09/May/16 ] | ||||||||
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}Message: In ./autogen.sh --enable-maintainer-flags, for some reason we check if We don't use g+, so don't check flags for g+ compatibility. | ||||||||
| Comment by A. Jesse Jiryu Davis [ 06/May/16 ] | ||||||||
|
With gcc 4.8.4 on Ubuntu Trusty:
We test this flag with our custom macro that tries each flag with the C and C++ compilers:
Since the C++ check comes second, it overwrites the first result and disables the compiler flag. This is the only flag we use that have different outcomes for C and C++ with gcc 4.8.4. P.S.: clang 700.1.81 on my Mac supports -Wdeclaration-after-statement in C++ mode:
|