Skip to content

Commit a10dd0c

Browse files
committed
Macros are not needed outside translation units
Macros are as local as types; we use macros for always-inlined functions, and contained symbols never end up in the symbol table. Thus macros must be removed before attempting to recurse into them for the purpose of symbol-table cleanup.
1 parent 4c4aa85 commit a10dd0c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

regression/ansi-c/always_inline1/main.c

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ static inline __attribute__((always_inline)) void unused(unsigned long offset)
2222
// discard it
2323
((void)sizeof(char[1 - 2 * !!(!__builtin_constant_p(offset))]));
2424
}
25+
26+
// unused, but no 'static'
27+
inline __attribute__((__always_inline__)) int also_unused(int _c)
28+
{
29+
return _c;
30+
}
2531
#endif
2632

2733
int main()

src/linking/remove_internal_symbols.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void remove_internal_symbols(
126126
is_file_local=false;
127127
}
128128

129-
if(is_type)
129+
if(is_type || symbol.is_macro)
130130
{
131131
// never EXPORTED by itself
132132
}

0 commit comments

Comments
 (0)