[Openmp-commits] [PATCH] D29353: [OpenMP] Redefined macro warning in libomptarget

George Rokos via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Jan 31 15:32:20 PST 2017


grokos created this revision.

After commit rL293468 <https://reviews.llvm.org/rL293468>, macro `__STDC_FORMAT_MACROS` is defined twice:

1. the compile line for `omptarget.cpp` specifies `-D__STDC_FORMAT_MACROS`
2. Now the macro is also defined in `omptarget.h`

This results in a warning. If libomptarget is compiled with `-Werror`, compilation will fail.
This is a patch which allow the definition of that macro in `omptarget.h` only if it has not been defined again.

Thanks to Carlo for finding out about the problem.


Repository:
  rL LLVM

https://reviews.llvm.org/D29353

Files:
  libomptarget/src/omptarget.h


Index: libomptarget/src/omptarget.h
===================================================================
--- libomptarget/src/omptarget.h
+++ libomptarget/src/omptarget.h
@@ -198,7 +198,10 @@
     fprintf(stderr, __VA_ARGS__);                                              \
   }
 
+#ifndef __STDC_FORMAT_MACROS
 #define __STDC_FORMAT_MACROS
+#endif
+
 #include <inttypes.h>
 #define DPxMOD "0x%0*" PRIxPTR
 #define DPxPTR(ptr) ((int)(2*sizeof(uintptr_t))), ((uintptr_t) (ptr))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29353.86505.patch
Type: text/x-patch
Size: 476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20170131/28d23aa4/attachment.bin>


More information about the Openmp-commits mailing list