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 compilation for GCC 15 + start covering GCC 15 in CI (fixes #40) #42

Conversation

hartwork
Copy link
Contributor

Fixes #40

Symptom was:
> In file included from system.h:268,
>                  from dcfldd.h:42,
>                  from dcfldd.c:33:
> sys2.h:297:7: error: conflicting types for 'ttyname'; have 'char *(void)'
>   297 | char *ttyname ();
>       |       ^~~~~~~
> In file included from system.h:33:
> /usr/include/unistd.h:799:14: note: previous declaration of 'ttyname' with type 'char *(int)'
>   799 | extern char *ttyname (int __fd) __THROW;
>       |              ^~~~~~~
Symtom was:
> In file included from xstrtoul.c:9:
> xstrtol.c:82:10: error: conflicting types for 'strtol'; have 'long int(void)'
>    82 | long int strtol ();
>       |          ^~~~~~
> In file included from /usr/include/features.h:510,
>                  from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
>                  from /usr/include/stdio.h:28,
>                  from xstrtol.c:32:
> /usr/include/stdlib.h:215:17: note: previous declaration of 'strtol' with type 'long int(const char * restrict,  char ** restrict,  int)'
>   215 | extern long int __REDIRECT_NTH (strtol, (const char *__restrict __nptr,
>       |                 ^~~~~~~~~~~~~~
> xstrtol.c:86:19: error: conflicting types for 'strtoul'; have 'long unsigned int(void)'
>    86 | unsigned long int strtoul ();
>       |                   ^~~~~~~
> /usr/include/stdlib.h:219:26: note: previous declaration of 'strtoul' with type 'long unsigned int(const char * restrict,  char ** restrict,  int)'
>   219 | extern unsigned long int __REDIRECT_NTH (strtoul,
>       |                          ^~~~~~~~~~~~~~
> xstrtol.c:90:11: error: conflicting types for 'strtoumax'; have 'uintmax_t(void)' {aka 'long unsigned int(void)'}
>    90 | uintmax_t strtoumax ();
>       |           ^~~~~~~~~
.. and make it consistent with the other places defining it.

With this patch:
> # git --no-pager grep "if.*PROTOTYPES"
> src/argmatch.h:#  if defined PROTOTYPES || (defined (__STDC__) && __STDC__)
> src/human.h:#  if defined PROTOTYPES || (defined __STDC__ && __STDC__)
> src/long-options.h:# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
> src/safe-read.h:# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
> src/sys2.h:# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
> src/version-etc.h:#  if defined PROTOTYPES || (defined __STDC__ && __STDC__)
> src/xalloc.h:#  if defined PROTOTYPES || (defined __STDC__ && __STDC__)
> src/xstrtol.h:#  if defined PROTOTYPES || (defined __STDC__ && __STDC__)

Symptom was:
> dcfldd.c: In function 'print_stats':
> dcfldd.c:229:13: error: too many arguments to function 'human_readable'
>   229 |             human_readable (r_full, buf[0], 1, 1),
>       |             ^~~~~~~~~~~~~~
> In file included from dcfldd.c:60:
> human.h:33:7: note: declared here
>    33 | char *human_readable PARAMS ((uintmax_t, char *, int, int));
>       |       ^~~~~~~~~~~~~~
> dcfldd.c:230:13: error: too many arguments to function 'human_readable'
>   230 |             human_readable (r_partial, buf[1], 1, 1));
>       |             ^~~~~~~~~~~~~~
> human.h:33:7: note: declared here
>    33 | char *human_readable PARAMS ((uintmax_t, char *, int, int));
>       |       ^~~~~~~~~~~~~~
> dcfldd.c:232:13: error: too many arguments to function 'human_readable'
>   232 |             human_readable (w_full, buf[0], 1, 1),
>       |             ^~~~~~~~~~~~~~
> human.h:33:7: note: declared here
>    33 | char *human_readable PARAMS ((uintmax_t, char *, int, int));
>       |       ^~~~~~~~~~~~~~
> dcfldd.c:233:13: error: too many arguments to function 'human_readable'
>   233 |             human_readable (w_partial, buf[1], 1, 1));
>       |             ^~~~~~~~~~~~~~
> human.h:33:7: note: declared here
>    33 | char *human_readable PARAMS ((uintmax_t, char *, int, int));
>       |       ^~~~~~~~~~~~~~
> dcfldd.c:236:17: error: too many arguments to function 'human_readable'
>   236 |                 human_readable (r_truncate, buf[0], 1, 1),
>       |                 ^~~~~~~~~~~~~~
> human.h:33:7: note: declared here
>    33 | char *human_readable PARAMS ((uintmax_t, char *, int, int));
>       |       ^~~~~~~~~~~~~~
Symptom was:
> md5.c: In function 'MD5Init':
> md5.c:83:6: warning: old-style function definition [-Wold-style-definition]
>    83 | void MD5Init (mdContext)
>       |      ^~~~~~~
> md5.c: In function 'MD5Update':
> md5.c:96:6: warning: old-style function definition [-Wold-style-definition]
>    96 | void MD5Update (mdContext, inBuf, inLen)
>       |      ^~~~~~~~~
> [..]
> md5.c: In function 'MD5Final':
> md5.c:131:6: warning: old-style function definition [-Wold-style-definition]
>   131 | void MD5Final (mdContext, buf)
>       |      ^~~~~~~~
> [..]
> md5.c: In function 'MD5Sprint':
> md5.c:175:6: warning: old-style function definition [-Wold-style-definition]
>   175 | void MD5Sprint (mdContext, buf)
>       |      ^~~~~~~~~
> md5.c: In function 'Transform':
> md5.c:187:13: warning: old-style function definition [-Wold-style-definition]
>   187 | static void Transform (buf, in)
>       |             ^~~~~~~~~
Symptom was:
> md5.c: In function 'MD5Update':
> md5.c:121:7: error: too many arguments to function 'Transform'
>   121 |       Transform (mdContext->buf, in);
>       |       ^~~~~~~~~
> md5.c:38:13: note: declared here
>    38 | static void Transform ();
>       |             ^~~~~~~~~
> md5.c: In function 'MD5Final':
> md5.c:151:3: error: too many arguments to function 'Transform'
>   151 |   Transform (mdContext->buf, in);
>       |   ^~~~~~~~~
> md5.c:38:13: note: declared here
>    38 | static void Transform ();
>       |             ^~~~~~~~~
Symptom was:
> long-options.c:51:1: error: conflicting types for 'parse_long_options'; have 'void(int,  char **, const char *, const char *, const char *, const char *, void (*)(void))'
>    51 | parse_long_options (int argc,
>       | ^~~~~~~~~~~~~~~~~~
> In file included from long-options.c:30:
> long-options.h:29:3: note: previous declaration of 'parse_long_options' with type 'void(int,  char **, const char *, const char *, const char *, const char *, void (*)(int))'
>    29 |   parse_long_options PARAMS ((int _argc,
>       |   ^~~~~~~~~~~~~~~~~~
> long-options.c: In function 'parse_long_options':
> long-options.c:73:12: error: too many arguments to function 'usage_func'
>    73 |           (*usage_func) (0);
>       |           ~^~~~~~~~~~~~
@davidpolverari
Copy link
Collaborator

LGTM. Merging. Happy Xmas!

@davidpolverari davidpolverari merged commit cffab09 into resurrecting-open-source-projects:master Dec 24, 2024
5 checks passed
@hartwork
Copy link
Contributor Author

@davidpolverari happy Christmas to you too! 🙏

@hartwork hartwork deleted the issue-40-fix-compilation-for-gcc-15 branch December 24, 2024 23:11
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.

Fails to compile with GCC 15 / -std=gnu23 / -std=c23
2 participants