Skip to content

Commit d6d0a49

Browse files
committed
C front-end: support alias attributes on variables
GCC only documents those for functions, but the Linux kernel code uses aliases when building kernel modules. These result from the expansion of the following macro defined in mdoule.h: #define MODULE_DEVICE_TABLE(type, name) \ extern typeof(name) __mod_##type##__##name##_device_table \ __attribute__ ((unused, alias(__stringify(name))))
1 parent 376beab commit d6d0a49

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
static const int my_ids[] = { 1, 2, 3, 4 };
2+
3+
#ifdef __GNUC__
4+
extern typeof(my_ids) my_ids_table __attribute__((alias("my_ids")));
5+
#endif
6+
7+
int main()
8+
{
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$

src/ansi-c/c_typecheck_base.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void c_typecheck_baset::typecheck_new_symbol(symbolt &symbol)
152152
it->set_identifier(irep_idt());
153153
}
154154
}
155-
else
155+
else if(!symbol.is_macro)
156156
{
157157
// check the initializer
158158
do_initializer(symbol);

0 commit comments

Comments
 (0)