Thanks to visit codestin.com
Credit goes to github.com

Skip to content

src/frontend/filter-datatypes.c does not compile with GCC 14 #165

@jamborm

Description

@jamborm

In order to declare function strdup, glibc requires that feature macro _XOPEN_SOURCE has value at least 500. In order to declare function timegm glibc from 2.19 on requires that feature macro _DEFAULT_SOURCE is defined, and that also is enough to get the declaration of strdup. Because src/frontend/filter-datatypes.c does not specify value for the former and does not define the latter, the file cannot be compiled with GCC 14 without suppressing errors about missing declarations. For more information, see https://gcc.gnu.org/gcc-14/porting_to.html and https://sourceware.org/glibc/manual/latest/html_node/Feature-Test-Macros.html

The error I get with gcc14 is:

gcc -DHAVE_CONFIG_H -I. -I../..    -std=gnu99 -fno-strict-aliasing -Wall  -g -O2 -I./ -I../ -DGIT_REV="\"1.1.6\"" -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/raptor2 -I/usr/include/rasqal -I/usr/include/raptor2 -I/usr/include/libxml2 `pcre-config --cflags` -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -fcommon -c -o filter-datatypes.o filter-datatypes.c
In file included from /usr/include/glib-2.0/glib.h:115,
                 from query-datatypes.h:4,
                 from filter.h:4,
                 from filter-datatypes.c:28:
/usr/include/glib-2.0/glib/deprecated/gthread.h:135:9: note: declared here
  135 | typedef struct
      |         ^~~~~~
filter-datatypes.c: In function 'fs_resource_value':
filter-datatypes.c:107:16: error: implicit declaration of function 'strdup' [-Wimplicit-function-declaration]
  107 |     res->lex = strdup(v.lex);
      |                ^~~~~~
filter-datatypes.c:107:16: warning: incompatible implicit declaration of built-in function 'strdup' [-Wbuiltin-declaration-mismatch]
filter-datatypes.c: In function 'fs_value_datetime_from_string':
filter-datatypes.c:267:16: error: implicit declaration of function 'timegm'; did you mean 'time'? [-Wimplicit-function-declaration]
  267 |         v.in = timegm(&td);
      |                ^~~~~~
      |                time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions