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

Skip to content

GCC 14 build fails due to --std=c99 #522

@ruro

Description

@ruro

src/tilda-lock-files.c uses popen from stdio.h:

if ((ps_output = popen (ps_command, "r")) == NULL) {

However, tilda seems to use C99 by default:

tilda/configure.ac

Lines 103 to 111 in 51bfe3c

#Use C99 compilation mode
if test "x$enable_clang" = "xyes"; then
# clang uses c99 mode by default, so we just set CC to clang and we are done
CC="clang";
else
# We do not need to set CC as the default is gcc, but we need to set it to
# use C99 compilation mode
CFLAGS="$CFLAGS -std=c99";
fi

And C99 doesn't enable POSIX extensions such as popen by default.


With GCC 13 and earlier, this would lead to the following warning:

src/tilda-lock-files.c:223:22: warning: implicit declaration of function 'popen'; did you mean 'open'? [-Wimplicit-function-declaration]
  223 |     if ((ps_output = popen (ps_command, "r")) == NULL) {
      |                      ^~~~~
      |                      open

It seems that starting with GCC 14, this warning is now an error.

src/tilda-lock-files.c:223:22: error: implicit declaration of function 'popen'; did you mean 'open'? [-Wimplicit-function-declaration]
  223 |     if ((ps_output = popen (ps_command, "r")) == NULL) {
      |                      ^~~~~
      |                      open

My understanding is that you should define _POSIX_C_SOURCE before importing stdio.h in tilda-lock-files.c or specify gnu99 instead of c99 in configure.ac.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions