public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libgo: add missing prototypes (PR 82922)
@ 2018-01-05  2:53 Martin Sebor
  2018-01-10 15:43 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Sebor @ 2018-01-05  2:53 UTC (permalink / raw)
  To: Gcc Patch List, Ian Lance Taylor

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

PR 82922 asks to enable -Wstrict-prototypes.  The attached
patch handles the errors in an x86_64 bootstrap.  With it,
GCC bootstraps successfully with --enable-languages=all,jit,
but there are many FAILs in the test suite but I think those
could be handled by a script so unless there are objections
it seems feasible to me to enable the optionin GCC 8.  Either
way, the libgo patch can be considered independently of that
decision.

Martin

[-- Attachment #2: gcc-82922.diff --]
[-- Type: text/x-patch, Size: 3167 bytes --]

PR c/82922 - Request: add -Wstrict-prototypes to -Wextra as K&R style is obsolescent

libgo/ChangeLog:
	PR c/82922
	* go/syscall/errno.c (GetErrno): Add a prototype.
	* runtime/go-now.c (now): Ditto.
	* runtime/go-runtime-error.c (__go_runtime_error): Ditto.
	* runtime/proc.c (runtime_getCgoHasExtraM): Ditto.
	* runtime/runtime.h (runtime_getAllP, runtime_getsched): Ditto.

diff --git a/libgo/go/syscall/errno.c b/libgo/go/syscall/errno.c
index 5cdc773..1e822f1 100644
--- a/libgo/go/syscall/errno.c
+++ b/libgo/go/syscall/errno.c
@@ -11,11 +11,11 @@
 /* errno is typically a macro. These functions set 
    and get errno specific to the libc being used.  */
 
-uintptr_t GetErrno() __asm__ (GOSYM_PREFIX "syscall.GetErrno");
+uintptr_t GetErrno(void) __asm__ (GOSYM_PREFIX "syscall.GetErrno");
 void SetErrno(uintptr_t) __asm__ (GOSYM_PREFIX "syscall.SetErrno");
 
 uintptr_t
-GetErrno()
+GetErrno(void)
 {
   return (uintptr_t) errno;
 }
diff --git a/libgo/runtime/go-now.c b/libgo/runtime/go-now.c
index 13e8f51..a45890b 100644
--- a/libgo/runtime/go-now.c
+++ b/libgo/runtime/go-now.c
@@ -16,11 +16,11 @@ struct walltime_ret
   int32_t nsec;
 };
 
-struct walltime_ret now() __asm__ (GOSYM_PREFIX "runtime.walltime")
+struct walltime_ret now(void) __asm__ (GOSYM_PREFIX "runtime.walltime")
   __attribute__ ((no_split_stack));
 
 struct walltime_ret
-now()
+now(void)
 {
   struct timespec ts;
   struct walltime_ret ret;
diff --git a/libgo/runtime/go-runtime-error.c b/libgo/runtime/go-runtime-error.c
index 4f563fc..5edbeeb 100644
--- a/libgo/runtime/go-runtime-error.c
+++ b/libgo/runtime/go-runtime-error.c
@@ -55,7 +55,7 @@ enum
   GO_NIL = 11
 };
 
-extern void __go_runtime_error () __attribute__ ((noreturn));
+extern void __go_runtime_error (int32) __attribute__ ((noreturn));
 
 void
 __go_runtime_error (int32 i)
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index d6e42e6..2d2ac19 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -364,7 +364,7 @@ runtime_mcall(FuncVal *fv)
 //
 // Design doc at http://golang.org/s/go11sched.
 
-extern bool* runtime_getCgoHasExtraM()
+extern bool* runtime_getCgoHasExtraM(void)
   __asm__ (GOSYM_PREFIX "runtime.getCgoHasExtraM");
 extern G* allocg(void)
   __asm__ (GOSYM_PREFIX "runtime.allocg");
@@ -548,7 +548,7 @@ void setGContext(void) __asm__ (GOSYM_PREFIX "runtime.setGContext");
 
 // setGContext sets up a new goroutine context for the current g.
 void
-setGContext()
+setGContext(void)
 {
 	int val;
 	G *gp;
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index 39b5ef8..ac767e3 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -472,9 +472,9 @@ extern void typedmemmove(const Type *, void *, const void *)
   __asm__ (GOSYM_PREFIX "runtime.typedmemmove");
 extern void setncpu(int32)
   __asm__(GOSYM_PREFIX "runtime.setncpu");
-extern P** runtime_getAllP()
+extern P** runtime_getAllP(void)
   __asm__ (GOSYM_PREFIX "runtime.getAllP");
-extern Sched* runtime_getsched()
+extern Sched* runtime_getsched(void)
   __asm__ (GOSYM_PREFIX "runtime.getsched");
 extern void setpagesize(uintptr_t)
   __asm__(GOSYM_PREFIX "runtime.setpagesize");

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libgo: add missing prototypes (PR 82922)
  2018-01-05  2:53 [PATCH] libgo: add missing prototypes (PR 82922) Martin Sebor
@ 2018-01-10 15:43 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2018-01-10 15:43 UTC (permalink / raw)
  To: Martin Sebor; +Cc: Gcc Patch List, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]

On Thu, Jan 4, 2018 at 6:53 PM, Martin Sebor <msebor@gmail.com> wrote:
>
> PR 82922 asks to enable -Wstrict-prototypes.  The attached
> patch handles the errors in an x86_64 bootstrap.  With it,
> GCC bootstraps successfully with --enable-languages=all,jit,
> but there are many FAILs in the test suite but I think those
> could be handled by a script so unless there are objections
> it seems feasible to me to enable the optionin GCC 8.  Either
> way, the libgo patch can be considered independently of that
> decision.

Thanks.  I committed a slightly modified version of this as follows.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 3240 bytes --]

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 256435)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-4b8036b3f995cdb0b99a9fa26c2af1e2420b4fa2
+9705a1f4c37ad2c099e9fe6cd587d22a2a2ab2c3
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/go/syscall/errno.c
===================================================================
--- libgo/go/syscall/errno.c	(revision 256366)
+++ libgo/go/syscall/errno.c	(working copy)
@@ -11,11 +11,11 @@
 /* errno is typically a macro. These functions set 
    and get errno specific to the libc being used.  */
 
-uintptr_t GetErrno() __asm__ (GOSYM_PREFIX "syscall.GetErrno");
+uintptr_t GetErrno(void) __asm__ (GOSYM_PREFIX "syscall.GetErrno");
 void SetErrno(uintptr_t) __asm__ (GOSYM_PREFIX "syscall.SetErrno");
 
 uintptr_t
-GetErrno()
+GetErrno(void)
 {
   return (uintptr_t) errno;
 }
Index: libgo/runtime/go-now.c
===================================================================
--- libgo/runtime/go-now.c	(revision 256366)
+++ libgo/runtime/go-now.c	(working copy)
@@ -16,11 +16,11 @@ struct walltime_ret
   int32_t nsec;
 };
 
-struct walltime_ret now() __asm__ (GOSYM_PREFIX "runtime.walltime")
+struct walltime_ret now(void) __asm__ (GOSYM_PREFIX "runtime.walltime")
   __attribute__ ((no_split_stack));
 
 struct walltime_ret
-now()
+now(void)
 {
   struct timespec ts;
   struct walltime_ret ret;
Index: libgo/runtime/go-runtime-error.c
===================================================================
--- libgo/runtime/go-runtime-error.c	(revision 256366)
+++ libgo/runtime/go-runtime-error.c	(working copy)
@@ -55,7 +55,7 @@ enum
   GO_NIL = 11
 };
 
-extern void __go_runtime_error () __attribute__ ((noreturn));
+extern void __go_runtime_error (int32) __attribute__ ((noreturn));
 
 void
 __go_runtime_error (int32 i)
Index: libgo/runtime/proc.c
===================================================================
--- libgo/runtime/proc.c	(revision 256366)
+++ libgo/runtime/proc.c	(working copy)
@@ -369,8 +369,6 @@ runtime_mcall(FuncVal *fv)
 //
 // Design doc at http://golang.org/s/go11sched.
 
-extern bool* runtime_getCgoHasExtraM()
-  __asm__ (GOSYM_PREFIX "runtime.getCgoHasExtraM");
 extern G* allocg(void)
   __asm__ (GOSYM_PREFIX "runtime.allocg");
 
@@ -560,7 +558,7 @@ void setGContext(void) __asm__ (GOSYM_PR
 
 // setGContext sets up a new goroutine context for the current g.
 void
-setGContext()
+setGContext(void)
 {
 	int val;
 	G *gp;
Index: libgo/runtime/runtime.h
===================================================================
--- libgo/runtime/runtime.h	(revision 256366)
+++ libgo/runtime/runtime.h	(working copy)
@@ -473,9 +473,7 @@ extern void typedmemmove(const Type *, v
   __asm__ (GOSYM_PREFIX "runtime.typedmemmove");
 extern void setncpu(int32)
   __asm__(GOSYM_PREFIX "runtime.setncpu");
-extern P** runtime_getAllP()
-  __asm__ (GOSYM_PREFIX "runtime.getAllP");
-extern Sched* runtime_getsched()
+extern Sched* runtime_getsched(void)
   __asm__ (GOSYM_PREFIX "runtime.getsched");
 extern void setpagesize(uintptr_t)
   __asm__(GOSYM_PREFIX "runtime.setpagesize");

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-10 15:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-05  2:53 [PATCH] libgo: add missing prototypes (PR 82922) Martin Sebor
2018-01-10 15:43 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).