Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SFIO no_stdio.h compilation failures #154

Open
meerfrau opened this issue Apr 22, 2023 · 0 comments
Open

SFIO no_stdio.h compilation failures #154

meerfrau opened this issue Apr 22, 2023 · 0 comments

Comments

@meerfrau
Copy link

gcc 12.2

SFIO's fclose.c, getchar.c and probably also scanf.c, vscanf.c and gets.c fail because stdio headers are missing:

fclose.c: In function 'fclose':
fclose.c:20:44: error: 'stdin' undeclared (first use in this function)
   20 |         if((rv = sfclose(sf)) >= 0 && f != stdin && f != stdout && f != stderr)
      |                                            ^~~~~
fclose.c:2:1: note: 'stdin' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?
    1 | #include        "sfstdio.h"
  +++ |+#include <stdio.h>
    2 | 
fclose.c:20:44: note: each undeclared identifier is reported only once for each function it appears in
   20 |         if((rv = sfclose(sf)) >= 0 && f != stdin && f != stdout && f != stderr)
      |                                            ^~~~~
fclose.c:20:58: error: 'stdout' undeclared (first use in this function)
   20 |         if((rv = sfclose(sf)) >= 0 && f != stdin && f != stdout && f != stderr)
      |                                                          ^~~~~~
fclose.c:20:58: note: 'stdout' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?
fclose.c:20:73: error: 'stderr' undeclared (first use in this function)
   20 |         if((rv = sfclose(sf)) >= 0 && f != stdin && f != stdout && f != stderr)
      |                                                                         ^~~~~~
fclose.c:20:73: note: 'stderr' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?
/* While building the compatible stdio interface, we don't want <stdio.h>
** to be included. Fortunately, these files tend to be protected by a single
** macro defined at the top of each file to prevent multiple inclusion.
** This header file defines the same macros here.

Therefore including <stdio.h> doesn't improve the situation:

fclose.c: In function 'fclose':
fclose.c:21:44: error: 'stdin' undeclared (first use in this function)
   21 |         if((rv = sfclose(sf)) >= 0 && f != stdin && f != stdout && f != stderr)
      |                                            ^~~~~
fclose.c:3:1: note: 'stdin' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?
    2 | #include <stdio.h>
  +++ |+#include <stdio.h>
    3 | 
fclose.c:21:44: note: each undeclared identifier is reported only once for each function it appears in
   21 |         if((rv = sfclose(sf)) >= 0 && f != stdin && f != stdout && f != stderr)
      |                                            ^~~~~
fclose.c:21:58: error: 'stdout' undeclared (first use in this function)
   21 |         if((rv = sfclose(sf)) >= 0 && f != stdin && f != stdout && f != stderr)
      |                                                          ^~~~~~
fclose.c:21:58: note: 'stdout' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?
fclose.c:21:73: error: 'stderr' undeclared (first use in this function)
   21 |         if((rv = sfclose(sf)) >= 0 && f != stdin && f != stdout && f != stderr)
      |                                                                         ^~~~~~
fclose.c:21:73: note: 'stderr' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?

How do I fix this?

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

No branches or pull requests

1 participant