leapmotion / autowiring

A C++ Inversion of Control Framework
http://autowiring.io/
Apache License 2.0
148 stars 17 forks source link

Avoid undefined behavior of defined() #1021

Closed jdonald closed 7 years ago

jdonald commented 7 years ago

When upgrading to clang for Android, we get this on virtually every source file:

In file included from /home/tombuilder/external-libraries/src/autowiring/src/autowiring/test/stdafx.h:7:
/home/tombuilder/external-libraries/src/autowiring/src/./autowiring/C++11/cpp11.h:11:5: warning: macro expansion producing
      'defined' has undefined behavior [-Wexpansion-to-defined]
#if IS_CLANG && !CLANG_CHECK(3, 6)

We should probably go ahead and fix this as clang is correct to point out that it's not part of the C preprocessor standard: https://gcc.gnu.org/onlinedocs/cpp/Defined.html

hham commented 7 years ago

Good to know the preprocessor standard.