Bug #65294 | my_global.h breaks __func__ on Linux with C99 | ||
---|---|---|---|
Submitted: | 12 May 2012 15:22 | Modified: | 14 May 2012 10:57 |
Reporter: | Andrew Clayton | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: C API (client library) | Severity: | S3 (Non-critical) |
Version: | 5.5.22, 5.5.25 | OS: | Linux (Fedora 16, 14) |
Assigned to: | CPU Architecture: | Any |
[12 May 2012 15:22]
Andrew Clayton
[12 May 2012 15:23]
Andrew Clayton
Simple test case for __func__ + my_global.h
Attachment: funcname.c (text/x-csrc), 164 bytes.
[12 May 2012 15:30]
Andrew Clayton
When compiling the test program with gcc -Wall -std=c99 -O2 -o funcname funcname.c `mysql-config --cflags --libs` it will show the function name as <unknown>. When compiling with gcc -Wall -O2 -o funcname funcname.c `mysql-config --cflags --libs` it displays as: main A simple workaround seems to be to do the following in your code #ifdef __func__ #undef __func__ #endif
[14 May 2012 10:57]
Valeriy Kravchuk
Thank you for the problem report. I also see difference/problems on FC14 using current mysql-5.5: [openxs@chief 5.5]$ gcc -Wall -O2 -o funcname funcname.c `bin/mysql_config --cflags --libs` funcname.c: In function ‘main’: funcname.c:6:14: warning: unused parameter ‘argc’ funcname.c:6:27: warning: unused parameter ‘argv’ [openxs@chief 5.5]$ gcc -Wall -std=c99 -O2 -o funcname funcname.c `bin/mysql_config --cflags --libs` In file included from funcname.c:4:0: /home/openxs/dbs/5.5/include/my_global.h:971:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘nesting_map’ In file included from /home/openxs/dbs/5.5/include/my_global.h:1039:0, from funcname.c:4: /home/openxs/dbs/5.5/include/my_dbug.h:37:3: error: expected specifier-qualifier-list before ‘uint’ /home/openxs/dbs/5.5/include/my_dbug.h:54:64: error: expected declaration specifiers or ‘...’ before ‘uint’ /home/openxs/dbs/5.5/include/my_dbug.h:56:31: error: expected ‘)’ before ‘_line_’ /home/openxs/dbs/5.5/include/my_dbug.h:57:30: error: expected ‘)’ before ‘_line_’ /home/openxs/dbs/5.5/include/my_dbug.h:60:29: error: expected ‘)’ before ‘_line_’ funcname.c: In function ‘main’: funcname.c:6:14: warning: unused parameter ‘argc’ funcname.c:6:27: warning: unused parameter ‘argv’ [openxs@chief 5.5]$ gcc --version gcc (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4) Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [openxs@chief 5.5]$ getconf GNU_LIBC_VERSION glibc 2.13