This is an archive of the discontinued LLVM Phabricator instance.

Avoid embedded preprocessor directives in __tree
ClosedPublic

Authored by dim on Aug 27 2016, 8:55 AM.

Details

Summary

When I compile <map> as part of clang, with -pedantic enabled, I get the
following warnings:

In file included from /usr/include/c++/v1/map:442:
/usr/include/c++/v1/__tree:874:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive]
#if _LIBCPP_STD_VER <= 11
 ^
/usr/include/c++/v1/__tree:877:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive]
#endif
 ^
/usr/include/c++/v1/__tree:1392:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive]
#if _LIBCPP_STD_VER <= 11
 ^
/usr/include/c++/v1/__tree:1395:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive]
#endif
 ^

This is because the #ifs are within the parameter list of a
_NOEXCEPT_() macro invocation. EricWF fixed something similar in
rL242623, by moving the #if outside the macro invocation.

Diff Detail

Event Timeline

dim updated this revision to Diff 69492.Aug 27 2016, 8:55 AM
dim retitled this revision from to Avoid embedded preprocessor directives in __tree.
dim updated this object.
dim added reviewers: mclow.lists, EricWF.
dim added subscribers: emaste, cfe-commits.
EricWF accepted this revision.Aug 27 2016, 9:05 AM
EricWF edited edge metadata.

LGTM. Thanks

This revision is now accepted and ready to land.Aug 27 2016, 9:05 AM
This revision was automatically updated to reflect the committed changes.
dim added a comment.Aug 28 2016, 3:24 AM

I saw some mails about it, but also that the failures were all in timing-related tests. The next runs seem to have succeeded, so these were false positives.