Skip to contentSkip to conversation

C89isms in the test suite

DISCUSSION Sam James 3 participants 4 messages Nov 14, 2022 – Nov 21, 2022 1 message not in the archive

lore
Share & tools
lore

Sam James

author
#1 lore raw
In reply to a message not in the archive
Quoted 22 lines · Florian Weimer via Gcc

What should we do about these when they are not relevant to what's being tested? For example, gcc/testsuite/gcc.c-torture/execute/ieee/mzero6.c has this:

int main ()

 {
   if (__builtin_copysign (1.0, func (0.0 / -5.0, 10)) != -1.0)
     abort ();
   exit (0);

}

but no include files, so abort and exit are implicitly declared.

Should we inject a header with -include with the most common declarations (which includes at least abort and exit)? Or add the missing #include directives? But the latter might not work for freestanding targets.

Quoted 6 lines

Implicit ints and function declarations without prototypes are also common (not just for main).

Other tests look like they might be intended to be built in C89 mode, e.g. gcc/testsuite/gcc.c-torture/compile/386.c, although it's not immediately obvious to me what they test.

Would you be able to backport 6be2672e4ee41c566a9e072088cccca263bab5f7 and 885b6660c17fb91980b5682514ef54668e544b02 to the active <13 branches?

Thanks,
sam

#2 lore raw

* Sam James:

Quoted 3 lines

Would you be able to backport 6be2672e4ee41c566a9e072088cccca263bab5f7 and 885b6660c17fb91980b5682514ef54668e544b02 to the active <13 branches?

Jakub, okay to backport these two (to 12, 11, 10 I presume)?

commit 6be2672e4ee41c566a9e072088cccca263bab5f7

Author: Florian Weimer <[email protected]>
Date:   Tue Oct 18 16:58:48 2022 +0200

libsanitizer: Avoid implicit function declaration in configure test

libsanitizer/

* configure.ac (sanitizer_supported): Include <unistd.h> for syscall prototype.
* configure: Regenerate.

commit 885b6660c17fb91980b5682514ef54668e544b02

Author: Florian Weimer <[email protected]>
Date:   Tue Oct 18 16:58:48 2022 +0200

libiberty: Fix C89-isms in configure tests

libiberty/

* acinclude.m4 (ac_cv_func_strncmp_works): Add missing int return type and parameter list to the definition of main. Include <stdlib.h> and <string.h> for prototypes. (ac_cv_c_stack_direction): Add missing
int return type and parameter list to the definitions of main, find_stack_direction. Include <stdlib.h> for exit prototype.
* configure: Regenerate.

Thanks,
Florian

author
#3 lore raw
Quoted 11 lines · Florian Weimer

* Sam James:

Quoted 3 lines

Would you be able to backport 6be2672e4ee41c566a9e072088cccca263bab5f7 and 885b6660c17fb91980b5682514ef54668e544b02 to the active <13 branches?

Jakub, okay to backport these two (to 12, 11, 10 I presume)?

(Yes please. It's also given me something to poke at as I didn't log the failure and only noticed when libasan wasn't installed...)

Thanks.

#4 lore raw
In reply to Florian Weimer
Quoted 7 lines · Florian Weimer

* Sam James:

Quoted 3 lines

Would you be able to backport 6be2672e4ee41c566a9e072088cccca263bab5f7 and 885b6660c17fb91980b5682514ef54668e544b02 to the active <13 branches?

Jakub, okay to backport these two (to 12, 11, 10 I presume)?

Ok.

Quoted 20 lines

commit 6be2672e4ee41c566a9e072088cccca263bab5f7

Author: Florian Weimer <[email protected]>
Date:   Tue Oct 18 16:58:48 2022 +0200

libsanitizer: Avoid implicit function declaration in configure test

libsanitizer/

* configure.ac (sanitizer_supported): Include <unistd.h> for syscall prototype.
* configure: Regenerate.

commit 885b6660c17fb91980b5682514ef54668e544b02

Author: Florian Weimer <[email protected]>
Date:   Tue Oct 18 16:58:48 2022 +0200

libiberty: Fix C89-isms in configure tests

libiberty/

Quoted 8 lines

* acinclude.m4 (ac_cv_func_strncmp_works): Add missing int return type and parameter list to the definition of main. Include <stdlib.h> and <string.h> for prototypes. (ac_cv_c_stack_direction): Add missing
int return type and parameter list to the definitions of main, find_stack_direction. Include <stdlib.h> for exit prototype.
* configure: Regenerate.

Jakub