Bug 1373562 part 2 - Apply source annotatoins for static analysis only when the compiler is clang. r?ehsan draft
authorTing-Yu Chou <janus926@gmail.com>
Tue, 22 Aug 2017 14:06:26 +0800
changeset 650392 032197afbc24c585432240ce83b09a986e37804d
parent 650391 322ea6ce8564a3e87dbb799ceb717e4c5e968088
child 650393 73b0c797051c1f6bd531b82f97da5628146d29e4
push id75370
push userbmo:janus926@gmail.com
push dateTue, 22 Aug 2017 08:50:02 +0000
reviewersehsan
bugs1373562
milestone57.0a1
Bug 1373562 part 2 - Apply source annotatoins for static analysis only when the compiler is clang. r?ehsan We need this when clang-cl fails compilation and falls back to MSVC, which doesn't understand the keyword. MozReview-Commit-ID: 5Vb0km1B31R
gfx/skia/skia/include/config/SkUserConfig.h
mfbt/Attributes.h
--- a/gfx/skia/skia/include/config/SkUserConfig.h
+++ b/gfx/skia/skia/include/config/SkUserConfig.h
@@ -153,17 +153,17 @@
 
 #define SK_RASTERIZE_EVEN_ROUNDING
 
 #define SK_DISABLE_SCREENSPACE_TESS_AA_PATH_RENDERER
 
 #define SK_DISABLE_SLOW_DEBUG_VALIDATION 1
 
 #ifndef MOZ_IMPLICIT
-#  ifdef MOZ_CLANG_PLUGIN
+#  if defined(MOZ_CLANG_PLUGIN) && defined(__clang__)
 #    define MOZ_IMPLICIT __attribute__((annotate("moz_implicit")))
 #  else
 #    define MOZ_IMPLICIT
 #  endif
 #endif
 
 #define MOZ_SKIA
 
--- a/mfbt/Attributes.h
+++ b/mfbt/Attributes.h
@@ -570,17 +570,17 @@
  *   within the calling block using an explicit `return` statement.
  *   Only calls to Constructors, references to local and member variables,
  *   and calls to functions or methods marked as MOZ_MAY_CALL_AFTER_MUST_RETURN
  *   may be made after the MUST_RETURN_FROM_CALLER call.
  * MOZ_MAY_CALL_AFTER_MUST_RETURN: Applies to function or method declarations.
  *   Calls to these methods may be made in functions after calls a
  *   MOZ_MUST_RETURN_FROM_CALLER function or method.
  */
-#ifdef MOZ_CLANG_PLUGIN
+#if defined(MOZ_CLANG_PLUGIN) && defined(__clang__)
 #  define MOZ_MUST_OVERRIDE __attribute__((annotate("moz_must_override")))
 #  define MOZ_STACK_CLASS __attribute__((annotate("moz_stack_class")))
 #  define MOZ_NONHEAP_CLASS __attribute__((annotate("moz_nonheap_class")))
 #  define MOZ_HEAP_CLASS __attribute__((annotate("moz_heap_class")))
 #  define MOZ_NON_TEMPORARY_CLASS __attribute__((annotate("moz_non_temporary_class")))
 #  define MOZ_TRIVIAL_CTOR_DTOR __attribute__((annotate("moz_trivial_ctor_dtor")))
 #  ifdef DEBUG
      /* in debug builds, these classes do have non-trivial constructors. */