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

Fix contrib build with gcc 14 #119

Merged
merged 2 commits into from
Aug 19, 2024
Merged

Conversation

andhe
Copy link
Contributor

@andhe andhe commented Aug 17, 2024

The included commits fixes build problems with gcc 14 as reported in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075109

BEWARE: These changes has only been compile-tested, not tested on any actual input file!

andhe added 2 commits August 18, 2024 01:59
```
codepage.c: In function ‘handle_codepage’:
codepage.c:284:9: warning: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  284 |         fread(fonts, CPInfoHeader.size, 1, in);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Originally reported at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075109

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Add includes as suggested to fix missing implicit declarations and a
bunch of build failures that appeared with gcc 14:

```
cc -O2 -g -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-z,relro  splitfont.c   -o splitfont
splitfont.c: In function ‘dosplit’:
splitfont.c:19:17: error: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
   19 |                 exit(1);
      |                 ^~~~
splitfont.c:8:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
    7 | #include <sys/stat.h>
  +++ |+#include <stdlib.h>
    8 |
splitfont.c:19:17: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
   19 |                 exit(1);
      |                 ^~~~
splitfont.c:19:17: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
splitfont.c:21:13: error: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
   21 |         if (strlen(fontfile) >= sizeof(filename) - 4) {
      |             ^~~~~~
splitfont.c:8:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
    7 | #include <sys/stat.h>
  +++ |+#include <string.h>
    8 |
splitfont.c:21:13: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
   21 |         if (strlen(fontfile) >= sizeof(filename) - 4) {
      |             ^~~~~~
splitfont.c:21:13: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
splitfont.c:23:17: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
   23 |                 exit(1);
      |                 ^~~~
splitfont.c:23:17: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
splitfont.c: In function ‘main’:
splitfont.c:51:17: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
   51 |                 exit(1);
      |                 ^~~~
splitfont.c:51:17: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
splitfont.c:56:17: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
   56 |                 exit(1);
      |                 ^~~~
splitfont.c:56:17: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
splitfont.c:60:17: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
   60 |                 exit(1);
      |                 ^~~~
splitfont.c:60:17: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
splitfont.c:64:17: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
   64 |                 exit(1);
      |                 ^~~~
splitfont.c:64:17: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
splitfont.c:69:17: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
   69 |                 exit(1);
      |                 ^~~~
splitfont.c:69:17: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
splitfont.c:74:17: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
   74 |                 exit(1);
      |                 ^~~~
splitfont.c:74:17: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
splitfont.c:79:29: error: implicit declaration of function ‘strtoul’ [-Wimplicit-function-declaration]
   79 |                 to = from = strtoul(p, &q, 0);
      |                             ^~~~~~~
splitfont.c:86:25: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
   86 |                         exit(1);
      |                         ^~~~
splitfont.c:86:25: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
```

Originally reported at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075109

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
@andhe andhe force-pushed the fix-contrib-gcc14 branch from 56323e6 to d8ba05d Compare August 17, 2024 23:59
@legionus legionus merged commit 11d4562 into legionus:master Aug 19, 2024
5 checks passed
@legionus
Copy link
Owner

Applied. Thanks!

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