summaryrefslogtreecommitdiff
path: root/definitionsconsistencycheck.cmake
diff options
context:
space:
mode:
authorMyungJoo Ham <myungjoo.ham@gmail.com>2016-06-23 20:13:46 +0900
committerJan Vorlicek <janvorli@microsoft.com>2016-06-23 13:13:46 +0200
commit9ae38ddd84ac77e52f76a04c1c87a17742ba06da (patch)
treef198e82e2e50d3e664a3f82b97edcf35535bd87e /definitionsconsistencycheck.cmake
parent70ac3533bfd4d4ebce6d834c3656b2d6c5bae941 (diff)
downloadcoreclr-9ae38ddd84ac77e52f76a04c1c87a17742ba06da.tar.gz
coreclr-9ae38ddd84ac77e52f76a04c1c87a17742ba06da.tar.bz2
coreclr-9ae38ddd84ac77e52f76a04c1c87a17742ba06da.zip
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 <myungjoo.ham@samsung.com> * Scripts: add check-definitions.py scripts/check-definitions.py 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 (build.sh will do so if no options such as skipnative or skipmanaged are given.) Fix #4674 Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> * Scripts: allow check-definitions py to ignore the harmless The third argument of check-definitions.py specifies harmless keywords to be suppressed from emitting warning messages. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> * 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 <myungjoo.ham@samsung.com>
Diffstat (limited to 'definitionsconsistencycheck.cmake')
-rw-r--r--definitionsconsistencycheck.cmake11
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} )
+ if($ENV{VERBOSE})
+ message( STATUS "Compiler Definition: " ${d} )
+ endif($ENV{VERBOSE})
+ file(APPEND cmake.definitions ${d})
+ file(APPEND cmake.definitions "\n")
+endforeach()