-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcc-defines
More file actions
executable file
·30 lines (26 loc) · 848 Bytes
/
cc-defines
File metadata and controls
executable file
·30 lines (26 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
# Show C/C++ macros pre-defined by the compiler:
#
# $ cc-defines | head
# #define __amd64 1
# #define __amd64__ 1
# <...>
#
# $ CC=arm-none-eabi-gcc cc-defines | head
# #define __ACCUM_EPSILON__ 0x1P-15K
# <...>
# #define __arm__ 1
# <...>
# See also:
# GCC Manual: Common Predefined Macros: http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
# Pre-defined C/C++ Compiler Macros Wiki: http://sourceforge.net/p/predef/wiki/Home/
# C/C++ tip: How to list compiler predefined macros: http://nadeausoftware.com/articles/2011/12/c_c_tip_how_list_compiler_predefined_macros
# See also:
# http://www.commandlinefu.com/commands/view/3917/display-gcc-predefined-macros#comment
# 1: gcc -dM -E - <<<''
# 2: echo | gcc -dM -E -
# 3: cpp -dM /dev/null
if [ "$CC" = "" ]; then
CC=gcc
fi
$CC "$@" -dM -E -x c - < /dev/null | sort