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 build with gcc 4.8 #108

Closed
wants to merge 1 commit into from
Closed

fix build with gcc 4.8 #108

wants to merge 1 commit into from

Conversation

ffontaine
Copy link
Contributor

Fx the following build failures with gcc 4.8 raised since version 0.9.4 and 674efd8 and 220163d:

wavemon.h: In function 'argv_find':
wavemon.h:311:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for (size_t i = 0; argv[i]; i++)
  ^

about_scr.c: In function 'scr_about_init':
about_scr.c:40:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for (size_t i = 0; i < ARRAY_SIZE(about_lines); i++) {
  ^
about_scr.c:42:3: error: 'for' loop initial declarations are only allowed in C99 mode
   for (size_t j = 0; j < strlen(about_lines[i]); j++)
   ^

Fixes:

Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

Fx the following build failures with gcc 4.8 raised since version 0.9.4
and
674efd8
and
220163d:

wavemon.h: In function 'argv_find':
wavemon.h:311:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for (size_t i = 0; argv[i]; i++)
  ^

about_scr.c: In function 'scr_about_init':
about_scr.c:40:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for (size_t i = 0; i < ARRAY_SIZE(about_lines); i++) {
  ^
about_scr.c:42:3: error: 'for' loop initial declarations are only allowed in C99 mode
   for (size_t j = 0; j < strlen(about_lines[i]); j++)
   ^

Fixes:
 - http://autobuild.buildroot.org/results/a6ee162cf04b70b144b54e1ca4b7b2421071c50c

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
@grrtrr
Copy link
Contributor

grrtrr commented Dec 20, 2021

@ffontaine - does the code compile with gcc 4.8 using -std=c99 in CFLAGS?

@ffontaine
Copy link
Contributor Author

Indeed, an other option is to add -std=gnu99 in CFLAGS by updating the following line:

CFLAGS ?= @CFLAGS@ @LIBNL3_CLI_CFLAGS@

It should be noted that adding -std=c99 will result in a build failure because sigaction will be undefined.

I can update the PR if you prefer this solution.

@grrtrr
Copy link
Contributor

grrtrr commented Dec 20, 2021

I am not able to test now, but according to this comment -std=gnu99 works with a gnu compiler for the sigaction struct. There should be a better solution, using appropriate defines instead.

grrtrr added a commit that referenced this pull request Dec 21, 2021
This updates the build set-up to check for and set C99 settings.
Tested with gcc-4.8 and 7.5.
@grrtrr
Copy link
Contributor

grrtrr commented Dec 21, 2021

Can you try the latest update on master (979a75e)?

Since the change is in configure.ac / configure, you would need to run

./configure && make 

@ffontaine
Copy link
Contributor Author

The build failure is fixed with your patch, I'm closing this PR

@ffontaine ffontaine closed this Dec 21, 2021
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