Skip to content

Commit

Permalink
Unify architecture naming in MACH_TYPE
Browse files Browse the repository at this point in the history
(refactoring)

* docs/porting.md (Adding platforms to gcconfig.h): Specify that
MACH_TYPE, OS_TYPE must be a quoted name of the corresponding macro.
* include/private/gcconfig.h [M68K]: Add comment.
* include/private/gcconfig.h [LOONGARCH] (MACH_TYPE): Change the string
value to upper case.
* include/private/gcconfig.h [TILEPRO] (MACH_TYPE): Likewise.
* include/private/gcconfig.h [TILEGX] (MACH_TYPE): Likewise.
* include/private/gcconfig.h [WEBASSEMBLY] (MACH_TYPE): Likewise.
* include/private/gcconfig.h [TILEGX] (MACH_TYPE): Remove "-" from the
string value.
* include/private/gcconfig.h [RISCV] (MACH_TYPE): Likewise.
  • Loading branch information
ivmai committed Oct 18, 2024
1 parent c826de6 commit 0699506
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/porting.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ The following macros must be defined correctly for each architecture and
operating system:

* `MACH_TYPE` - Defined to a string that represents the machine
architecture. Usually just the macro name used to identify the architecture,
architecture. This is just the macro name used to identify the architecture,
but enclosed in quotes.
* `OS_TYPE` - Defined to a string that represents the operating system name.
Usually just the macro name used to identify the operating system, but
This is just the macro name used to identify the operating system, but
enclosed in quotes.
* `CPP_WORDSZ` - The address (also referred simply as "word") size in bits
as a constant suitable for preprocessor tests, i.e. without casts or
Expand Down
13 changes: 8 additions & 5 deletions include/private/gcconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,9 @@ EXTERN_C_BEGIN
# endif
#endif /* SYMBIAN */

/* Below are the definitions specific to each supported architecture */
/* and OS, grouped by the former. */

#ifdef M68K
# define MACH_TYPE "M68K"
# define CPP_WORDSZ 32
Expand Down Expand Up @@ -1589,7 +1592,7 @@ extern char **environ;
#endif /* NS32K */

#ifdef LOONGARCH
# define MACH_TYPE "LoongArch"
# define MACH_TYPE "LOONGARCH"
# define CPP_WORDSZ _LOONGARCH_SZPTR
# ifdef LINUX
# pragma weak __data_start
Expand Down Expand Up @@ -2354,7 +2357,7 @@ extern int __data_start[] __attribute__((__weak__));
#endif /* HEXAGON */

#ifdef TILEPRO
# define MACH_TYPE "TILEPro"
# define MACH_TYPE "TILEPRO"
# define CPP_WORDSZ 32
# define PREFETCH(x) __insn_prefetch(x)
# define CACHE_LINE_SIZE 64
Expand All @@ -2365,7 +2368,7 @@ extern int __data_start[];
#endif /* TILEPRO */

#ifdef TILEGX
# define MACH_TYPE "TILE-Gx"
# define MACH_TYPE "TILEGX"
# define CPP_WORDSZ (__SIZEOF_PTRDIFF_T__ * 8)
# if CPP_WORDSZ == 32
# define CLEAR_DOUBLE(x) (void)(*(long long *)(x) = 0)
Expand All @@ -2379,7 +2382,7 @@ extern int __data_start[];
#endif /* TILEGX */

#ifdef RISCV
# define MACH_TYPE "RISC-V"
# define MACH_TYPE "RISCV"
# define CPP_WORDSZ (__SIZEOF_SIZE_T__ * 8) /* 32 or 64 */
# ifdef FREEBSD
/* Nothing specific. */
Expand Down Expand Up @@ -2407,7 +2410,7 @@ extern char **environ;
#endif /* RISCV */

#ifdef WEBASSEMBLY
# define MACH_TYPE "WebAssembly"
# define MACH_TYPE "WEBASSEMBLY"
# if defined(__wasm64__) && !defined(CPPCHECK)
# error 64-bit WebAssembly is not yet supported
# endif
Expand Down

0 comments on commit 0699506

Please sign in to comment.