gcc.misc-tests/linkage-y.c: Compatibility with C99+ system compilers

Message ID 874jhfi2k2.fsf@oldenburg.str.redhat.com
State Committed
Commit 08ba7e8b98e71d72c2bb3860f8d3642ce380afdf
Headers
Series gcc.misc-tests/linkage-y.c: Compatibility with C99+ system compilers |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Testing passed

Commit Message

Florian Weimer Nov. 21, 2023, 2:49 p.m. UTC
  This program is compiled with an installed "cc" compiler, not the
built GCC compiler, so it should be as compatible as possible across a
wide range of compilers.

gcc/testsuite/

	* gcc.misc-tests/linkage-y.c (puts): Declare.
	(main): Add int return type and return 0.

---
 gcc/testsuite/gcc.misc-tests/linkage-y.c | 3 +++
 1 file changed, 3 insertions(+)


base-commit: 700d70e4a2874645ddb67a8a335131d83b242e69
  

Comments

Joseph Myers Nov. 21, 2023, 11:45 p.m. UTC | #1
On Tue, 21 Nov 2023, Florian Weimer wrote:

> This program is compiled with an installed "cc" compiler, not the
> built GCC compiler, so it should be as compatible as possible across a
> wide range of compilers.
> 
> gcc/testsuite/
> 
> 	* gcc.misc-tests/linkage-y.c (puts): Declare.
> 	(main): Add int return type and return 0.

OK.
  

Patch

diff --git a/gcc/testsuite/gcc.misc-tests/linkage-y.c b/gcc/testsuite/gcc.misc-tests/linkage-y.c
index eaffa5e4bb7..4235325f2cb 100644
--- a/gcc/testsuite/gcc.misc-tests/linkage-y.c
+++ b/gcc/testsuite/gcc.misc-tests/linkage-y.c
@@ -1,8 +1,11 @@ 
 /* 920717-y.c */
 
 extern const char s[];
+extern int puts(const char *);
 
+int
 main()
 {
 	puts(s);
+	return 0;
 }