[SERVER-8897] Avoid using non-portable ##__VA_ARGS comma elision construct in mongo initializers facility Created: 07/Mar/13 Updated: 11/Jul/16 Resolved: 22/Mar/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 2.5.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Andrew Morrow (Inactive) | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | c++11 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Participants: |
| Description |
|
We currently make use of the GCC extension that gives special behavior to the token pasted ##_VA_ARGS_ expression, such that the comma before the ## is elided: http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html While this extension is widely honored by other compilers, C99 actually introduced a specification for variadic macros, and that specification does not honor this construction. As a result, when we compile with -std=c++11 we get the C99 version of variadic macros rather than the GNU version, so the commas are no longer elided as our macros expcet and the mongo initializer stuff breaks. In the interest of avoiding non-portable compiler extensions, even if widely implemented in other compilers, we should avoid using the token-pasting trick and find another way to make the mongo initializer macros work. |
| Comments |
| Comment by auto [ 08/Mar/13 ] |
|
Author: {u'date': u'2013-03-07T19:42:30Z', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}Message: |