Skip to content

Conversation

gordon0001
Copy link

GCC14 errors about some functions not explicitly included like close in pipe.c and socket.c
dirent.c didn't like <sys/dirent.h> but <dirent.h> is ok and it compiles.
"sys/dirent.h" should also work

This shouldn't break compilation on GCC lower than 14

GCC14 wants unistd.h included for the function "close" otherwise the compiler will give you an error:

Implicit declaration of function 'close' is invalid in C99
GCC14 wants unistd.h included for the function "close" otherwise the compiler will give you an error:

Implicit declaration of function 'close' is invalid in C99
GCC14 wants dirent.h included for the function "readdir", "opendir", "closedir" otherwise the compiler will give you the following errors::

1) implicit declaration of function 'opendir'
2) implicit declaration of function 'readdir'
3) implicit declaration of function 'closedir'
4) initialization of 'DIR *' {aka 'struct DIR_ *'} from 'int' makes pointer from integer without a cast 
5) assignment to 'struct dirent *' from 'int' makes pointer from integer without a cast
@saghul
Copy link

saghul commented Jan 20, 2025

I'm trying to compile it with gcc 13.3.0 and I'm getting the following error:

/Users/saghul/src/vita/buildscripts/build/newlib-prefix/src/newlib/newlib/libc/sys/vita/pipe.c: In function 'pipe2':
/Users/saghul/src/vita/buildscripts/build/newlib-prefix/src/newlib/newlib/libc/sys/vita/pipe.c:116:5: warning: implicit declaration of function 'close'; did you mean 'pclose'? [-Wimplicit-function-declaration]
  116 |     close(pipefd[0]);
      |     ^~~~~
      |     pclose
/Users/saghul/src/vita/buildscripts/build/newlib-prefix/src/newlib/newlib/libc/sys/vita/fcntl.c: In function '_fcntl_r':
/Users/saghul/src/vita/buildscripts/build/newlib-prefix/src/newlib/newlib/libc/sys/vita/fcntl.c:40:57: error: 'O_ASYNC' undeclared (first use in this function); did you mean 'O_SYNC'?
   40 | #define SETFL_FLAGS (O_NONBLOCK | O_APPEND | O_DIRECT | O_ASYNC | O_SYNC | O_DSYNC)
      |                                                         ^~~~~~~
/Users/saghul/src/vita/buildscripts/build/newlib-prefix/src/newlib/newlib/libc/sys/vita/fcntl.c:133:37: note: in expansion of macro 'SETFL_FLAGS'
  133 |                         arg = arg & SETFL_FLAGS;
      |                                     ^~~~~~~~~~~
/Users/saghul/src/vita/buildscripts/build/newlib-prefix/src/newlib/newlib/libc/sys/vita/fcntl.c:40:57: note: each undeclared identifier is reported only once for each function it appears in
   40 | #define SETFL_FLAGS (O_NONBLOCK | O_APPEND | O_DIRECT | O_ASYNC | O_SYNC | O_DSYNC)
      |                                                         ^~~~~~~
/Users/saghul/src/vita/buildscripts/build/newlib-prefix/src/newlib/newlib/libc/sys/vita/fcntl.c:133:37: note: in expansion of macro 'SETFL_FLAGS'
  133 |                         arg = arg & SETFL_FLAGS;
      |                                     ^~~~~~~~~~~
/Users/saghul/src/vita/buildscripts/build/newlib-prefix/src/newlib/newlib/libc/sys/vita/fcntl.c:40:76: error: 'O_DSYNC' undeclared (first use in this function); did you mean 'O_SYNC'?
   40 | #define SETFL_FLAGS (O_NONBLOCK | O_APPEND | O_DIRECT | O_ASYNC | O_SYNC | O_DSYNC)
      |                                                                            ^~~~~~~
/Users/saghul/src/vita/buildscripts/build/newlib-prefix/src/newlib/newlib/libc/sys/vita/fcntl.c:133:37: note: in expansion of macro 'SETFL_FLAGS'
  133 |                         arg = arg & SETFL_FLAGS;
      |                                     ^~~~~~~~~~~

Your description suggests the 1st problem is addressed. I'm curious if you ran into the second?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants