[compiler-rt] r189015 - [sanitizer] Fix build when scanf interceptors are enabled, and __isoc99_*scanf are not.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Thu Aug 22 06:59:15 PDT 2013


Author: eugenis
Date: Thu Aug 22 08:59:15 2013
New Revision: 189015

URL: http://llvm.org/viewvc/llvm-project?rev=189015&view=rev
Log:
[sanitizer] Fix build when scanf interceptors are enabled, and __isoc99_*scanf are not.

Fixes PR16916.

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=189015&r1=189014&r2=189015&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Thu Aug 22 08:59:15 2013
@@ -565,24 +565,31 @@ INTERCEPTOR(int, __isoc99_sscanf, const
 SCANF_INTERCEPTOR_IMPL(__isoc99_sscanf, __isoc99_vsscanf, str, format)
 #endif
 
-#define INIT_SCANF                                                             \
-  INTERCEPT_FUNCTION(scanf);                                                   \
-  INTERCEPT_FUNCTION(sscanf);                                                  \
-  INTERCEPT_FUNCTION(fscanf);                                                  \
-  INTERCEPT_FUNCTION(vscanf);                                                  \
-  INTERCEPT_FUNCTION(vsscanf);                                                 \
-  INTERCEPT_FUNCTION(vfscanf);                                                 \
-  INTERCEPT_FUNCTION(__isoc99_scanf);                                          \
-  INTERCEPT_FUNCTION(__isoc99_sscanf);                                         \
-  INTERCEPT_FUNCTION(__isoc99_fscanf);                                         \
-  INTERCEPT_FUNCTION(__isoc99_vscanf);                                         \
-  INTERCEPT_FUNCTION(__isoc99_vsscanf);                                        \
-  INTERCEPT_FUNCTION(__isoc99_vfscanf);
+#endif
 
+#if SANITIZER_INTERCEPT_SCANF
+#define INIT_SCANF             \
+  INTERCEPT_FUNCTION(scanf);   \
+  INTERCEPT_FUNCTION(sscanf);  \
+  INTERCEPT_FUNCTION(fscanf);  \
+  INTERCEPT_FUNCTION(vscanf);  \
+  INTERCEPT_FUNCTION(vsscanf); \
+  INTERCEPT_FUNCTION(vfscanf);
 #else
 #define INIT_SCANF
 #endif
 
+#if SANITIZER_INTERCEPT_ISOC99_SCANF
+#define INIT_ISOC99_SCANF               \
+  INTERCEPT_FUNCTION(__isoc99_scanf);   \
+  INTERCEPT_FUNCTION(__isoc99_sscanf);  \
+  INTERCEPT_FUNCTION(__isoc99_fscanf);  \
+  INTERCEPT_FUNCTION(__isoc99_vscanf);  \
+  INTERCEPT_FUNCTION(__isoc99_vsscanf); \
+  INTERCEPT_FUNCTION(__isoc99_vfscanf);
+#else
+#define INIT_ISOC99_SCANF
+#endif
 
 #if SANITIZER_INTERCEPT_IOCTL
 #include "sanitizer_common_interceptors_ioctl.inc"
@@ -2005,6 +2012,7 @@ INTERCEPTOR(int, ppoll, __sanitizer_poll
   INIT_PRCTL;                              \
   INIT_LOCALTIME_AND_FRIENDS;              \
   INIT_SCANF;                              \
+  INIT_ISOC99_SCANF;                       \
   INIT_FREXP;                              \
   INIT_FREXPF_FREXPL;                      \
   INIT_GETPWNAM_AND_FRIENDS;               \





More information about the llvm-commits mailing list