[PATCH] D61173: [BPF] do not generate predefined macro bpf

Yonghong Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 25 23:17:37 PDT 2019


yonghong-song updated this revision to Diff 196799.
yonghong-song edited the summary of this revision.
yonghong-song added a comment.

remove __bpf.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61173/new/

https://reviews.llvm.org/D61173

Files:
  lib/Basic/Targets/BPF.cpp
  test/Preprocessor/bpf-predefined-macros.c


Index: test/Preprocessor/bpf-predefined-macros.c
===================================================================
--- /dev/null
+++ test/Preprocessor/bpf-predefined-macros.c
@@ -0,0 +1,16 @@
+// RUN: %clang -E -target bpfel -x c -o - %s | FileCheck %s
+// RUN: %clang -E -target bpfeb -x c -o - %s | FileCheck %s
+
+#ifdef __bpf__
+int b;
+#endif
+#ifdef __BPF__
+int c;
+#endif
+#ifdef bpf
+int d;
+#endif
+
+// CHECK: int b;
+// CHECK: int c;
+// CHECK-NOT: int d;
Index: lib/Basic/Targets/BPF.cpp
===================================================================
--- lib/Basic/Targets/BPF.cpp
+++ lib/Basic/Targets/BPF.cpp
@@ -20,7 +20,7 @@
 
 void BPFTargetInfo::getTargetDefines(const LangOptions &Opts,
                                      MacroBuilder &Builder) const {
-  DefineStd(Builder, "bpf", Opts);
+  Builder.defineMacro("__bpf__");
   Builder.defineMacro("__BPF__");
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61173.196799.patch
Type: text/x-patch
Size: 894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190426/3ec6ff32/attachment.bin>


More information about the cfe-commits mailing list