This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Go patch committed: error on func declaration/definition


Long long long ago Go permitted writing
    func F()
in one file and writing
    func F() {}
in another file.  This was removed from the language, and that is now
considered to be a multiple definition error.  Gccgo never caught up
to that, and it has been permitting this invalid code for some time.

Stop permitting it, so that we give correct errors.  Since we've
supported it for a long time, the compiler uses it in a couple of
cases: it predeclares the hash/equal methods if it decides to create
them while compiling another function, and it predeclares main.main as
a mechanism for getting the right warning if a program uses the wrong
signature for main.  For simplicity, keep those existing uses.

This required a few minor changes in libgo which were relying,
unnecessarily, on the current behavior.

Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]