path: root/definitionsconsistencycheck.cmake
diff options
authorMyungJoo Ham <>2016-06-23 20:13:46 +0900
committerJan Vorlicek <>2016-06-23 13:13:46 +0200
commit9ae38ddd84ac77e52f76a04c1c87a17742ba06da (patch)
treef198e82e2e50d3e664a3f82b97edcf35535bd87e /definitionsconsistencycheck.cmake
parent70ac3533bfd4d4ebce6d834c3656b2d6c5bae941 (diff)
Scripts: verify compiler definitions of native and managed (#4675)
* Scripts: find out compiler definitions of CMake In order to find mismatch between native and managed, we need to know the list of definitions of native. The copmiler definitions are stored at cmake.definitions This addresses the complaints of #4674 Signed-off-by: MyungJoo Ham <> * Scripts: add scripts/ checks the consistency between the native-build (CMake) compiler definitions and the managed-build (MSBuild/mscorlib) compiler definitions at build-time and prints out potentially dangerous inconsistencies. In order to get the proper results, managed build should be executed after the native build ( will do so if no options such as skipnative or skipmanaged are given.) Fix #4674 Signed-off-by: MyungJoo Ham <> * Scripts: allow check-definitions py to ignore the harmless The third argument of specifies harmless keywords to be suppressed from emitting warning messages. Signed-off-by: MyungJoo Ham <> * Scripts: add ignored cdefine keywords for warning As an example of how to declare compiler definition keywords that are harmless to be inconsistent between the native and the managed, we have added FEATURE_IMPLICIT_TLS and FEATURE_HIJACK. Developers may add more keywords in System.Private.CoreLib.csproj if the keywords are verified to be harmless; i.e., although the keywords exist in both cmake and clr.coreclr.props, the keywords are NEVER used in either side of the sources or the keywords only happen to have the same name while they denote the completely different semantics and may be disjoint. Signed-off-by: MyungJoo Ham <>
Diffstat (limited to 'definitionsconsistencycheck.cmake')
1 files changed, 11 insertions, 0 deletions
diff --git a/definitionsconsistencycheck.cmake b/definitionsconsistencycheck.cmake
new file mode 100644
index 0000000000..cc029bb799
--- /dev/null
+++ b/definitionsconsistencycheck.cmake
@@ -0,0 +1,11 @@
+get_directory_property( DirDefs COMPILE_DEFINITIONS )
+# Reset the definition file
+file(WRITE cmake.definitions "")
+foreach( d ${DirDefs} )
+ message( STATUS "Compiler Definition: " ${d} )
+ endif($ENV{VERBOSE})
+ file(APPEND cmake.definitions ${d})
+ file(APPEND cmake.definitions "\n")