john.brawn updated this revision to Diff 525165.
john.brawn added a comment.

Use -Eonly in test.


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

https://reviews.llvm.org/D150966

Files:
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/Basic/Targets/AVR.cpp
  clang/lib/Basic/Targets/CSKY.cpp
  clang/lib/Basic/Targets/Hexagon.cpp
  clang/lib/Basic/Targets/Le64.cpp
  clang/lib/Basic/Targets/MSP430.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Basic/Targets/RISCV.cpp
  clang/lib/Basic/Targets/VE.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/test/Preprocessor/init-ve.c
  clang/test/Preprocessor/predefined-macros-no-warnings.c

Index: clang/test/Preprocessor/predefined-macros-no-warnings.c
===================================================================
--- /dev/null
+++ clang/test/Preprocessor/predefined-macros-no-warnings.c
@@ -0,0 +1,199 @@
+// Check that the predefined macros don't contain anything that causes a
+// warning, which needs -Wsystem-headers to detect as the predefined macros
+// are in the <built-in> file which is treated as a system header and so has
+// warnings suppressed by default.
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arc
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple xcore
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple hexagon
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple hexagon-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple lanai
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64_32-darwin
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64-darwin
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64-cloudabi
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64-fuchsia
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64-linux-openhos
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64-openbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64-win32-gnu
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64-win32-msvc
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64_be
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64_be-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64_be-fuchsia
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64_be-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple aarch64_be-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-darwin
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-cloudabi
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-fuchsia
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-linux-openhos
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-liteos
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-openbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-rtems
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-nacl
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-win32-cygnus
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-win32-gnu
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-win32-itanium
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple arm-win32-msvc
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple armeb
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple armeb-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple armeb-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple armeb-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple armeb-openbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple armeb-rtems
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple avr
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple bpfeb
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple bpfel
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple msp430
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips-rtems
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mipsel
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mipsel-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mipsel-linux-openhos
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mipsel-rtems
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mipsel-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mipsel-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mipsel-nacl
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips64
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips64-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips64-rtems
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips64-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips64-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips64-openbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips64el
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips64el-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips64el-rtems
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips64el-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips64el-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple mips64el-openbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple m68k
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple m68k-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple m68k-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple le32-nacl
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple le64
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc-openbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc-rtems
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc-aix
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppcle
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppcle-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppcle-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc64
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc64-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc64-lv2
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc64-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc64-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc64-openbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc64-aix
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc64le-
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc64le-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc64le-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc64le-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ppc64le-openbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple nvptx
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple nvptx64
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple amdgcn
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple r600
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple riscv32
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple riscv32-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple riscv32-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple riscv64
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple riscv64-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple riscv64-openbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple riscv64-fuchsia
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple riscv64-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple riscv64-linux-openhos
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparc
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparc-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparc-solaris
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparc-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparc-rtems
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparcel
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparcel-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparcel-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparcel-rtems
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparcv9
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparcv9-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparcv9-solaris
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparcv9-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparcv9-openbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparcv9-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparcv9-systemz
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparcv9-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple sparcv9-zos
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple tce
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple tcele
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-darwin
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-ananas
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-cloudabi
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-linux-android
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-dragonfly
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-openbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-fuchsia
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-kfreebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-minix
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-solaris
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-win32-cygnus
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-win32-gnu
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-win32-itanium
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-win32-msvc
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-haiku
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-rtems
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-nacl
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-elfiamcu
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-hurd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-darwin
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-ananas
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-cloudabi
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-linux-android
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-linux-openhos
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-dragonfly
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-netbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-openbsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-freebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-fuchsia
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-kfreebsd
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-solaris
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-win32cygnus
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-win32gnu
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-win32msvc
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-haiku
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-nacl
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-ps4
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-ps5
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple spir
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple spir64
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple spirv32
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple spirv64
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple wasm32
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple wasm32-wasi
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple wasm32-emscripten
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple wasm64
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple wasm64-wasi
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple wasm64-emscripten
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple dxil
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple renderscript32
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple renderscript64
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple ve
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple csky
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple csky-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple loongarch32
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple loongarch32-linux
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple loongarch64
+// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple loongarch64-linux
Index: clang/test/Preprocessor/init-ve.c
===================================================================
--- clang/test/Preprocessor/init-ve.c
+++ clang/test/Preprocessor/init-ve.c
@@ -2,9 +2,11 @@
 /// REQUIRES: ve-registered-target
 
 // RUN: %clang_cc1 -E -dM -triple=ve < /dev/null | \
-// RUN:     FileCheck -match-full-lines -check-prefix VE %s
+// RUN:     FileCheck -match-full-lines -check-prefixes=VE,VE-HOSTED %s
+// RUN: %clang_cc1 -E -dM -triple=ve -ffreestanding < /dev/null | \
+// RUN:     FileCheck -match-full-lines -check-prefixes=VE,VE-FREESTANDING %s
 // RUN: %clang_cc1 -x c++ -E -dM -triple=ve < /dev/null | \
-// RUN:     FileCheck -match-full-lines -check-prefix VE -check-prefix VE-CXX %s
+// RUN:     FileCheck -match-full-lines -check-prefixes=VE,VE-HOSTED,VE-CXX %s
 //
 // VE:#define _LP64 1
 // VE:#define __BIGGEST_ALIGNMENT__ 8
@@ -160,7 +162,8 @@
 // VE:#define __SIZE_TYPE__ long unsigned int
 // VE:#define __SIZE_WIDTH__ 64
 // VE-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL
-// VE:#define __STDC_HOSTED__ 1
+// VE-HOSTED:#define __STDC_HOSTED__ 1
+// VE-FREESTANDING:#define __STDC_HOSTED__ 0
 // VE:#define __UINT16_C_SUFFIX__
 // VE:#define __UINT16_FMTX__ "hX"
 // VE:#define __UINT16_FMTo__ "ho"
Index: clang/lib/Frontend/InitPreprocessor.cpp
===================================================================
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -1299,6 +1299,10 @@
     Builder.defineMacro("__GLIBCXX_BITSIZE_INT_N_0", "128");
   }
 
+  // ELF targets define __ELF__
+  if (TI.getTriple().isOSBinFormatELF())
+    Builder.defineMacro("__ELF__");
+
   // Get other target #defines.
   TI.getTargetDefines(LangOpts, Builder);
 }
Index: clang/lib/Basic/Targets/VE.cpp
===================================================================
--- clang/lib/Basic/Targets/VE.cpp
+++ clang/lib/Basic/Targets/VE.cpp
@@ -26,14 +26,8 @@
 
 void VETargetInfo::getTargetDefines(const LangOptions &Opts,
                                     MacroBuilder &Builder) const {
-  Builder.defineMacro("_LP64", "1");
-  Builder.defineMacro("unix", "1");
-  Builder.defineMacro("__unix__", "1");
-  Builder.defineMacro("__linux__", "1");
   Builder.defineMacro("__ve", "1");
   Builder.defineMacro("__ve__", "1");
-  Builder.defineMacro("__STDC_HOSTED__", "1");
-  Builder.defineMacro("__STDC__", "1");
   Builder.defineMacro("__NEC__", "1");
   // FIXME: define __FAST_MATH__ 1 if -ffast-math is enabled
   // FIXME: define __OPTIMIZE__ n if -On is enabled
Index: clang/lib/Basic/Targets/RISCV.cpp
===================================================================
--- clang/lib/Basic/Targets/RISCV.cpp
+++ clang/lib/Basic/Targets/RISCV.cpp
@@ -124,7 +124,6 @@
 
 void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts,
                                        MacroBuilder &Builder) const {
-  Builder.defineMacro("__ELF__");
   Builder.defineMacro("__riscv");
   bool Is64Bit = getTriple().getArch() == llvm::Triple::riscv64;
   Builder.defineMacro("__riscv_xlen", Is64Bit ? "64" : "32");
Index: clang/lib/Basic/Targets/OSTargets.h
===================================================================
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -41,12 +41,9 @@
   void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
                     MacroBuilder &Builder) const override {
     Builder.defineMacro("__CloudABI__");
-    Builder.defineMacro("__ELF__");
 
     // CloudABI uses ISO/IEC 10646:2012 for wchar_t, char16_t and char32_t.
     Builder.defineMacro("__STDC_ISO_10646__", "201206L");
-    Builder.defineMacro("__STDC_UTF_16__");
-    Builder.defineMacro("__STDC_UTF_32__");
   }
 
 public:
@@ -61,7 +58,6 @@
                     MacroBuilder &Builder) const override {
     // Ananas defines
     Builder.defineMacro("__Ananas__");
-    Builder.defineMacro("__ELF__");
   }
 
 public:
@@ -177,7 +173,6 @@
     // DragonFly defines; list based off of gcc output
     Builder.defineMacro("__DragonFly__");
     Builder.defineMacro("__DragonFly_cc_version", "100001");
-    Builder.defineMacro("__ELF__");
     Builder.defineMacro("__KPRINTF_ATTRIBUTE__");
     Builder.defineMacro("__tune_i386__");
     DefineStd(Builder, "unix", Opts);
@@ -222,7 +217,6 @@
     Builder.defineMacro("__FreeBSD_cc_version", Twine(CCVersion));
     Builder.defineMacro("__KPRINTF_ATTRIBUTE__");
     DefineStd(Builder, "unix", Opts);
-    Builder.defineMacro("__ELF__");
 
     // On FreeBSD, wchar_t contains the number of the code point as
     // used by the character set of the locale. These character sets are
@@ -274,7 +268,6 @@
     DefineStd(Builder, "unix", Opts);
     Builder.defineMacro("__FreeBSD_kernel__");
     Builder.defineMacro("__GLIBC__");
-    Builder.defineMacro("__ELF__");
     if (Opts.POSIXThreads)
       Builder.defineMacro("_REENTRANT");
     if (Opts.CPlusPlus)
@@ -293,7 +286,6 @@
                     MacroBuilder &Builder) const override {
     // Haiku defines; list based off of gcc output
     Builder.defineMacro("__HAIKU__");
-    Builder.defineMacro("__ELF__");
     DefineStd(Builder, "unix", Opts);
     if (this->HasFloat128)
       Builder.defineMacro("__FLOAT128__");
@@ -330,7 +322,6 @@
     Builder.defineMacro("__gnu_hurd__");
     Builder.defineMacro("__MACH__");
     Builder.defineMacro("__GLIBC__");
-    Builder.defineMacro("__ELF__");
     if (Opts.POSIXThreads)
       Builder.defineMacro("_REENTRANT");
     if (Opts.CPlusPlus)
@@ -355,7 +346,6 @@
     Builder.defineMacro("_EM_LSIZE", "4");
     Builder.defineMacro("_EM_FSIZE", "4");
     Builder.defineMacro("_EM_DSIZE", "8");
-    Builder.defineMacro("__ELF__");
     DefineStd(Builder, "unix", Opts);
   }
 
@@ -372,7 +362,6 @@
     // Linux defines; list based off of gcc output
     DefineStd(Builder, "unix", Opts);
     DefineStd(Builder, "linux", Opts);
-    Builder.defineMacro("__ELF__");
     if (Triple.isAndroid()) {
       Builder.defineMacro("__ANDROID__", "1");
       this->PlatformName = "android";
@@ -434,7 +423,6 @@
     // NetBSD defines; list based off of gcc output
     Builder.defineMacro("__NetBSD__");
     Builder.defineMacro("__unix__");
-    Builder.defineMacro("__ELF__");
     if (Opts.POSIXThreads)
       Builder.defineMacro("_REENTRANT");
   }
@@ -456,7 +444,6 @@
 
     Builder.defineMacro("__OpenBSD__");
     DefineStd(Builder, "unix", Opts);
-    Builder.defineMacro("__ELF__");
     if (Opts.POSIXThreads)
       Builder.defineMacro("_REENTRANT");
     if (this->HasFloat128)
@@ -502,10 +489,8 @@
   void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
                     MacroBuilder &Builder) const override {
     // PS3 PPU defines.
-    Builder.defineMacro("__PPC__");
     Builder.defineMacro("__PPU__");
     Builder.defineMacro("__CELLOS_LV2__");
-    Builder.defineMacro("__ELF__");
     Builder.defineMacro("__LP32__");
     Builder.defineMacro("_ARCH_PPC64");
     Builder.defineMacro("__powerpc64__");
@@ -533,7 +518,6 @@
     Builder.defineMacro("__FreeBSD_cc_version", "900001");
     Builder.defineMacro("__KPRINTF_ATTRIBUTE__");
     DefineStd(Builder, "unix", Opts);
-    Builder.defineMacro("__ELF__");
     Builder.defineMacro("__SCE__");
     Builder.defineMacro("__STDC_NO_COMPLEX__");
     Builder.defineMacro("__STDC_NO_THREADS__");
@@ -608,7 +592,6 @@
     // RTEMS defines; list based off of gcc output
 
     Builder.defineMacro("__rtems__");
-    Builder.defineMacro("__ELF__");
     if (Opts.CPlusPlus)
       Builder.defineMacro("_GNU_SOURCE");
   }
@@ -643,7 +626,6 @@
                     MacroBuilder &Builder) const override {
     DefineStd(Builder, "sun", Opts);
     DefineStd(Builder, "unix", Opts);
-    Builder.defineMacro("__ELF__");
     Builder.defineMacro("__svr4__");
     Builder.defineMacro("__SVR4");
     // Solaris headers require _XOPEN_SOURCE to be set to 600 for C99 and
@@ -874,7 +856,6 @@
       Builder.defineMacro("_GNU_SOURCE");
 
     DefineStd(Builder, "unix", Opts);
-    Builder.defineMacro("__ELF__");
     Builder.defineMacro("__native_client__");
   }
 
@@ -921,7 +902,6 @@
   void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
                     MacroBuilder &Builder) const override {
     Builder.defineMacro("__Fuchsia__");
-    Builder.defineMacro("__ELF__");
     if (Opts.POSIXThreads)
       Builder.defineMacro("_REENTRANT");
     // Required by the libc++ locale support.
@@ -1016,8 +996,6 @@
     // Linux defines; list based off of gcc output
     DefineStd(Builder, "unix", Opts);
 
-    Builder.defineMacro("__ELF__");
-
     // Generic OHOS target defines
     if (Triple.isOHOSFamily()) {
       Builder.defineMacro("__OHOS_FAMILY__", "1");
Index: clang/lib/Basic/Targets/MSP430.cpp
===================================================================
--- clang/lib/Basic/Targets/MSP430.cpp
+++ clang/lib/Basic/Targets/MSP430.cpp
@@ -29,6 +29,5 @@
                                         MacroBuilder &Builder) const {
   Builder.defineMacro("MSP430");
   Builder.defineMacro("__MSP430__");
-  Builder.defineMacro("__ELF__");
   // FIXME: defines for different 'flavours' of MCU
 }
Index: clang/lib/Basic/Targets/Le64.cpp
===================================================================
--- clang/lib/Basic/Targets/Le64.cpp
+++ clang/lib/Basic/Targets/Le64.cpp
@@ -27,5 +27,4 @@
                                       MacroBuilder &Builder) const {
   DefineStd(Builder, "unix", Opts);
   defineCPUMacros(Builder, "le64", /*Tuning=*/false);
-  Builder.defineMacro("__ELF__");
 }
Index: clang/lib/Basic/Targets/Hexagon.cpp
===================================================================
--- clang/lib/Basic/Targets/Hexagon.cpp
+++ clang/lib/Basic/Targets/Hexagon.cpp
@@ -24,8 +24,6 @@
   Builder.defineMacro("__qdsp6__", "1");
   Builder.defineMacro("__hexagon__", "1");
 
-  Builder.defineMacro("__ELF__");
-
   // The macro __HVXDBL__ is deprecated.
   bool DefineHvxDbl = false;
 
Index: clang/lib/Basic/Targets/CSKY.cpp
===================================================================
--- clang/lib/Basic/Targets/CSKY.cpp
+++ clang/lib/Basic/Targets/CSKY.cpp
@@ -33,7 +33,6 @@
 
 void CSKYTargetInfo::getTargetDefines(const LangOptions &Opts,
                                       MacroBuilder &Builder) const {
-  Builder.defineMacro("__ELF__");
   Builder.defineMacro("__csky__", "2");
   Builder.defineMacro("__CSKY__", "2");
   Builder.defineMacro("__ckcore__", "2");
@@ -52,8 +51,10 @@
 
   Builder.defineMacro("__" + ArchName.upper() + "__");
   Builder.defineMacro("__" + ArchName.lower() + "__");
-  Builder.defineMacro("__" + CPUName.upper() + "__");
-  Builder.defineMacro("__" + CPUName.lower() + "__");
+  if (ArchName != CPUName) {
+    Builder.defineMacro("__" + CPUName.upper() + "__");
+    Builder.defineMacro("__" + CPUName.lower() + "__");
+  }
 
   // TODO: Add support for BE if BE was supported later
   StringRef endian = "__cskyLE__";
Index: clang/lib/Basic/Targets/AVR.cpp
===================================================================
--- clang/lib/Basic/Targets/AVR.cpp
+++ clang/lib/Basic/Targets/AVR.cpp
@@ -450,7 +450,6 @@
   Builder.defineMacro("AVR");
   Builder.defineMacro("__AVR");
   Builder.defineMacro("__AVR__");
-  Builder.defineMacro("__ELF__");
 
   if (ABI == "avrtiny")
     Builder.defineMacro("__AVR_TINY__", "1");
Index: clang/lib/Basic/Targets/ARM.cpp
===================================================================
--- clang/lib/Basic/Targets/ARM.cpp
+++ clang/lib/Basic/Targets/ARM.cpp
@@ -711,10 +711,9 @@
   // For bare-metal none-eabi.
   if (getTriple().getOS() == llvm::Triple::UnknownOS &&
       (getTriple().getEnvironment() == llvm::Triple::EABI ||
-       getTriple().getEnvironment() == llvm::Triple::EABIHF)) {
-    Builder.defineMacro("__ELF__");
-    if (Opts.CPlusPlus)
-      Builder.defineMacro("_GNU_SOURCE");
+       getTriple().getEnvironment() == llvm::Triple::EABIHF) &&
+      Opts.CPlusPlus) {
+    Builder.defineMacro("_GNU_SOURCE");
   }
 
   // Target properties.
Index: clang/lib/Basic/Targets/AArch64.cpp
===================================================================
--- clang/lib/Basic/Targets/AArch64.cpp
+++ clang/lib/Basic/Targets/AArch64.cpp
@@ -238,8 +238,6 @@
 void AArch64TargetInfo::getTargetDefinesARMV81A(const LangOptions &Opts,
                                                 MacroBuilder &Builder) const {
   Builder.defineMacro("__ARM_FEATURE_QRDMX", "1");
-  Builder.defineMacro("__ARM_FEATURE_ATOMICS", "1");
-  Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
 }
 
 void AArch64TargetInfo::getTargetDefinesARMV82A(const LangOptions &Opts,
@@ -335,16 +333,6 @@
   Builder.defineMacro("__aarch64__");
   // Inline assembly supports AArch64 flag outputs.
   Builder.defineMacro("__GCC_ASM_FLAG_OUTPUTS__");
-  // For bare-metal.
-  if (getTriple().getOS() == llvm::Triple::UnknownOS &&
-      getTriple().isOSBinFormatELF())
-    Builder.defineMacro("__ELF__");
-
-  // Target properties.
-  if (!getTriple().isOSWindows() && getTriple().isArch64Bit()) {
-    Builder.defineMacro("_LP64");
-    Builder.defineMacro("__LP64__");
-  }
 
   std::string CodeModel = getTargetOpts().CodeModel;
   if (CodeModel == "default")
@@ -1523,7 +1511,6 @@
   else
     Builder.defineMacro("__ARM64_ARCH_8__");
   Builder.defineMacro("__ARM_NEON__");
-  Builder.defineMacro("__LITTLE_ENDIAN__");
   Builder.defineMacro("__REGISTER_PREFIX__", "");
   Builder.defineMacro("__arm64", "1");
   Builder.defineMacro("__arm64__", "1");
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to