[all-commits] [llvm/llvm-project] 78bf8a: [clang] Don't define predefined macros multiple times

john-brawn-arm via All-commits all-commits at lists.llvm.org
Wed May 24 09:28:57 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 78bf8a0a2212c1826ce2a9c0f98c73e9b9b16367
      https://github.com/llvm/llvm-project/commit/78bf8a0a2212c1826ce2a9c0f98c73e9b9b16367
  Author: John Brawn <john.brawn at arm.com>
  Date:   2023-05-24 (Wed, 24 May 2023)

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

  Log Message:
  -----------
  [clang] Don't define predefined macros multiple times

Fix several instances of macros being defined multiple times
in several targets. Most of these are just simple duplication in a
TargetInfo or OSTargetInfo of things already defined in
InitializePredefinedMacros or InitializeStandardPredefinedMacros,
but there are a few that aren't:
 * AArch64 defines a couple of feature macros for armv8.1a that are
   handled generically by getTargetDefines.
 * CSKY needs to take care when CPUName and ArchName are the same.
 * Many os/target combinations result in __ELF__ being defined twice.
   Instead define __ELF__ just once in InitPreprocessor based on
   the Triple, which already knows what the object format is based
   on os and target.

These changes shouldn't change the final result of which macros are
defined, with the exception of the changes to __ELF__ where if you
explicitly specify the object type in the triple then this affects
if __ELF__ is defined, e.g. --target=i686-windows-elf results in it
being defined where it wasn't before, but this is more accurate as an
ELF file is in fact generated.

Differential Revision: https://reviews.llvm.org/D150966




More information about the All-commits mailing list