Bug #56506 | __FUNCTION__ is not a macro in Linux gcc/g++ | ||
---|---|---|---|
Submitted: | 2 Sep 2010 16:50 | Modified: | 22 Sep 2010 12:32 |
Reporter: | peter kwong | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / C++ | Severity: | S3 (Non-critical) |
Version: | 1.0.5 | OS: | Linux |
Assigned to: | Ulf Wendel | CPU Architecture: | Any |
[2 Sep 2010 16:50]
peter kwong
[10 Sep 2010 4:06]
Alexey Kishkin
Verified on centos 5.3, gcc version 4.1.2 20080704 (Red Hat 4.1.2-44) $ ./static_test 1..2 # # Client version: 5.1.36 # 0 - total_errors 0, last_error_total = 0 # Host=tcp://127.0.0.1 # User=root #--------------- 1 ----------------- # # ERR: Caught sql::SQLException at (function n/a)::2139 [Can't connect to MySQL server on '127.0.0.1' (111)] (2003/HY000) not ok $ cat /etc/redhat-release CentOS release 5.3 (Final) and on ubuntu 10.4 with gcc version 4.4.3 $ ./static_test 1..2 # # Client version: 5.1.41 # 0 - total_errors 0, last_error_total = 0 # Host=tcp://127.0.0.1 # User=root #--------------- 1 ----------------- # # ERR: Caught sql::SQLException at (function n/a)::2139 [Access denied for user 'root'@'localhost' (using password: YES)] (1045/28000) not ok in both cases no function names in the output.
[22 Sep 2010 10:07]
Ulf Wendel
__FUNCTION__ does not follow any standards, AFAIK. I am not sure if we shall "fix" this. Its about example code. Whatever we do, there will always be a compiler or OS that does it differently. Maybe we take the GCC part from libmysql and that's it? For comparison: MySQL 5.1.50 - sql/sql_profile.h #ifndef __func__ #ifdef __FUNCTION__ #define __func__ __FUNCTION__ #else #define __func__ "unknown function" #endif #endif Libmysql - libmysql/include/my_global.h: #if __STDC_VERSION__ < 199901L # if __GNUC__ >= 2 # define __func__ __FUNCTION__ # else # define __func__ "<unknown>" # endif #elif defined(_MSC_VER) # if _MSC_VER < 1300 # define __func__ "<unknown>" # else # define __func__ __FUNCTION__ # endif #elif defined(__BORLANDC__) # define __func__ __FUNC__ #else # define __func__ "<unknown>" #endif
[22 Sep 2010 12:32]
Ulf Wendel
This has been fixed in the development tree (revision 899) and will be available in the next GA version which is 1.1.1.