Skip to content

Commit a614345

Browse files
committed
Macros are not needed outside translation units
Macros are are 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 47770f4 commit a614345

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
@@ -19,6 +19,12 @@ static inline __attribute__((always_inline)) void unused(unsigned long offset)
1919
{
2020
((void)sizeof(char[1 - 2 * !!(!__builtin_constant_p(offset))]));
2121
}
22+
23+
// unused, but no 'static'
24+
inline __attribute__((__always_inline__)) int also_unused(int _c)
25+
{
26+
return _c;
27+
}
2228
#endif
2329

2430
int main()

src/linking/remove_internal_symbols.cpp

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

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

0 commit comments

Comments
 (0)