From 659e2b5088eb960594844d2dd3625779c11476ca Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Sun, 26 May 2024 20:01:31 -0700 Subject: [PATCH] Use `gcc -E` for `cpp` (#1639) * Fix cpp for macs? * Add comment * Move cppflags with cpp --- Makefile | 12 +++++------- tools/disasm/disasm.py | 8 ++++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 30a272dca6..5285f40517 100644 --- a/Makefile +++ b/Makefile @@ -87,12 +87,6 @@ BASEROM_DIR := baseroms/$(VERSION) BUILD_DIR := build/$(VERSION) EXTRACTED_DIR := extracted/$(VERSION) -CPPFLAGS += -P - -ifeq ($(DETECTED_OS), macos) - CPPFLAGS += -xc++ -endif - #### Tools #### ifneq ($(shell type $(MIPS_BINUTILS_PREFIX)ld >/dev/null 2>/dev/null; echo $$?), 0) @@ -143,7 +137,11 @@ ifeq ($(RUN_CC_CHECK),0) CC_CHECK_COMP := @: endif -CPP := cpp +# The `cpp` command behaves differently on macOS (it behaves as if +# `-traditional-cpp` was passed) so we use `gcc -E` instead. +CPP := gcc -E +CPPFLAGS += -P -xc -fno-dollars-in-identifiers + MKLDSCRIPT := tools/buildtools/mkldscript MKDMADATA := tools/buildtools/mkdmadata ZAPD := tools/ZAPD/ZAPD.out diff --git a/tools/disasm/disasm.py b/tools/disasm/disasm.py index 52c5825753..9eec939ecf 100755 --- a/tools/disasm/disasm.py +++ b/tools/disasm/disasm.py @@ -1097,10 +1097,10 @@ def find_symbols_in_rodata(section): def asm_header(section_name: str): return f""".include "macro.inc" -# assembler directives -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches -.set gp=64 # allow use of 64-bit general purpose registers +/* assembler directives */ +.set noat /* allow manual use of $at */ +.set noreorder /* don't insert nops after branches */ +.set gp=64 /* allow use of 64-bit general purpose registers */ .section {section_name}