CC (gcc) [L libsrdb1.so.1.0] db_ut.o In file included from /usr/include/time.h:27:0, from db_ut.c:50: /usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp] # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/620
-- Commit Summary --
* lib/srdb1: fix compiler warning
-- File Changes --
M lib/srdb1/db_ut.c (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/620.patch https://github.com/kamailio/kamailio/pull/620.diff
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/620
Is this ok also for older versions of gcc (like in Debian Wheezy)? If yes, it can be merged, if not maybe both can be defined.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/620#issuecomment-219657612
Sadly it doesn't work for wheezy ``` root@8bf1261570c6:/code# cat /etc/debian_version 7.10 root@8bf1261570c6:/code# gcc --version gcc (Debian 4.7.2-5) 4.7.2 Copyright (C) 2012 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. ``` ``` CC (gcc) [L libsrdb1.so.1.0] db_ut.o In file included from ../../parser/../mem/../lock_ops.h:75:0, from ../../parser/../mem/shm.h:39, from ../../parser/../mem/shm_mem.h:34, from ../../parser/../ut.h:45, from ../../parser/../ip_addr.h:40, from ../../parser/msg_parser.h:37, from ../../pvar.h:32, from db_ut.h:34, from db_ut.c:68: ../../parser/../mem/../futexlock.h: In function 'futex_get': ../../parser/../mem/../futexlock.h:108:4: warning: implicit declaration of function 'syscall' [-Wimplicit-function-declaration] ```
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/620#issuecomment-219662516
We can use ``` __GNUC_PATCHLEVEL__ These macros are defined by all GNU compilers that use the C preprocessor: C, C++, Objective-C and Fortran. Their values are the major version, minor version, and patch level of the compiler, as integer constants. For example, GCC 3.2.1 will define __GNUC__ to 3, __GNUC_MINOR__ to 2, and __GNUC_PATCHLEVEL__ to 1. These macros are also defined if you invoke the preprocessor directly. __GNUC_PATCHLEVEL__ is new to GCC 3.0; it is also present in the widely-used development snapshots leading up to 3.0 (which identify themselves as GCC 2.96 or 2.97, depending on which snapshot you have).
If all you need to know is whether or not your program is being compiled by GCC, or a non-GCC compiler that claims to accept the GNU C dialects, you can simply test __GNUC__. If you need to write code which depends on a specific version, you must be more careful. Each time the minor version is increased, the patch level is reset to zero; each time the major version is increased (which happens rarely), the minor version and patch level are reset. If you wish to use the predefined macros directly in the conditional, you will need to write it like this:
/* Test for GCC > 3.2.0 */ #if __GNUC__ > 3 || \ (__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || \ (__GNUC_MINOR__ == 2 && \ __GNUC_PATCHLEVEL__ > 0)) Another approach is to use the predefined macros to calculate a single number, then compare that against a threshold:
#define GCC_VERSION (__GNUC__ * 10000 \ + __GNUC_MINOR__ * 100 \ + __GNUC_PATCHLEVEL__) ... /* Test for GCC > 3.2.0 */ #if GCC_VERSION > 30200 Many people find this form easier to understand. ``` from https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/620#issuecomment-219663003
for sure, for clang this doesn't work at all
``` CC (clang) [M db_mysql.so] km_dbase.o CC (clang) [M db_mysql.so] km_val.o CC (clang) [M db_mysql.so] my_fld.o CC (clang) [M db_mysql.so] km_row.o CC (clang) [M db_mysql.so] km_my_con.o CC (clang) [M db_mysql.so] km_res.o CC (clang) [M db_mysql.so] my_cmd.o In file included from my_cmd.c:46: In file included from ./my_cmd.h:25: In file included from ./../../lib/srdb2/db_drv.h:29: In file included from ./../../lib/srdb2/db_gen.h:30: In file included from ./../../lib/srdb2/../../str.h:24: In file included from /usr/include/string.h:25: /usr/include/features.h:148:3: warning: "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-W#warnings] # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" ^ 1 warning generated. CC (clang) [M db_mysql.so] my_con.o CC (clang) [M db_mysql.so] db_mysql.o CC (clang) [M db_mysql.so] my_res.o CC (clang) [M db_mysql.so] my_uri.o CC (clang) [M db_mysql.so] km_db_mysql.o CC (clang) [L libsrdb2.so.1.0] db_fld.o CC (clang) [L libsrdb2.so.1.0] db.o CC (clang) [L libsrdb2.so.1.0] db_con.o CC (clang) [L libsrdb2.so.1.0] db_res.o CC (clang) [L libsrdb2.so.1.0] db_rec.o CC (clang) [L libsrdb2.so.1.0] db_gen.o CC (clang) [L libsrdb2.so.1.0] db_pool.o CC (clang) [L libsrdb2.so.1.0] db_cmd.o CC (clang) [L libsrdb2.so.1.0] db_drv.o CC (clang) [L libsrdb2.so.1.0] db_uri.o CC (clang) [L libsrdb2.so.1.0] db_ctx.o LD (clang) [L libsrdb2.so.1.0] libsrdb2.so.1.0 CC (clang) [L libsrdb1.so.1.0] db_query.o CC (clang) [L libsrdb1.so.1.0] db_id.o CC (clang) [L libsrdb1.so.1.0] db.o CC (clang) [L libsrdb1.so.1.0] db_row.o CC (clang) [L libsrdb1.so.1.0] db_res.o CC (clang) [L libsrdb1.so.1.0] db_pool.o CC (clang) [L libsrdb1.so.1.0] db_ut.o In file included from db_ut.c:55: In file included from /usr/include/time.h:27: /usr/include/features.h:148:3: warning: "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-W#warnings] # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" ^ 1 warning generated. CC (clang) [L libsrdb1.so.1.0] db_val.o LD (clang) [L libsrdb1.so.1.0] libsrdb1.so.1.0 LD (clang) [M db_mysql.so] db_mysql.so ```
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/620#issuecomment-219672960
define both seems a better approach, trying right now
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/620#issuecomment-219673463
Merged #620.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/620#event-662850315