This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: g++ Frontend bug (or not?) introduced by your 1998/08/20 change.
- To: jason at cygnus dot com
- Subject: Re: PATCH: g++ Frontend bug (or not?) introduced by your 1998/08/20 change.
- From: Klaus-Georg Adams <Klaus-Georg dot Adams at chemie dot uni-karlsruhe dot de>
- Date: Wed, 14 Oct 1998 11:15:33 +0200
- CC: egcs-patches at cygnus dot com
>>>>> "Jason" == Jason Merrill <jason@cygnus.com> writes:
>>>>> Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de> writes:
>>>>> "Jason" == Jason Merrill <jason@cygnus.com> writes:
Jason> I think it would be better to fix this by checking
Jason> DECL_LANGUAGE in grokfndecl.
>> Like this?
Jason> Almost. I would like to keep the check for local types on
Jason> extern "C" functions, so it should attach to the
Jason> ANON_AGGRNAME_P test. I'll go ahead and put it in.
I think you got the logic mixed up. The testcase I included didn't
pass with your change, but with the attached patch it does pass.
Also: is there a reason why you test != lang_c and not ==
lang_cplusplus? Maybe someone will add an extern "Fortran"
specification to g++.
-- kga
-------------------------------------------------------------------------
Klaus-Georg Adams Email: Klaus-Georg.Adams@chemie.uni-karlsruhe.de
Institut f. Anorg. Chemie, Lehrstuhl II Tel: 49(0)721 608 3485
Universität Karlsruhe, D-76128 Karlsruhe
-------------------------------------------------------------------------
Index: gcc/cp/ChangeLog
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/ChangeLog,v
retrieving revision 1.733
diff -u -p -r1.733 ChangeLog
--- ChangeLog 1998/10/13 18:29:32 1.733
+++ ChangeLog 1998/10/14 09:07:05
@@ -1,3 +1,7 @@
+1998-10-14 Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
+
+ * decl.c (grokfndecl): Fix last change.
+
1998-10-13 Jason Merrill <jason@yorick.cygnus.com>
* tinfo2.cc (fast_compare): Remove.
Index: gcc/cp/decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.228
diff -u -p -r1.228 decl.c
--- decl.c 1998/10/13 18:29:34 1.228
+++ decl.c 1998/10/14 09:07:09
@@ -8024,12 +8024,11 @@ grokfndecl (ctype, type, declarator, ori
t = no_linkage_check (TREE_TYPE (decl));
if (t)
{
- if (ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))
- && DECL_LANGUAGE (decl) != lang_c)
- cp_pedwarn ("non-local function `%#D' uses anonymous type", decl);
- else
+ if (! ANON_AGGRNAME_P (TYPE_IDENTIFIER (t)))
cp_pedwarn ("non-local function `%#D' uses local type `%T'",
decl, t);
+ else if (DECL_LANGUAGE (decl) != lang_c)
+ cp_pedwarn ("non-local function `%#D' uses anonymous type", decl);
}
}
--- /dev/null Mon Jul 18 01:46:18 1994
+++ gcc/testsuite/g++.old-deja/g++.other/linkage2.C Thu Oct 8 14:19:14 1998
@@ -0,0 +1,14 @@
+// Build don't link:
+// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
+extern "C"
+{
+typedef struct {int dummy[10];} *GDBM_FILE;
+extern GDBM_FILE gdbm_open();
+}
+
+typedef struct { int dummy[10]; } *FAIL_FILE;
+extern FAIL_FILE fail_open(); // ERROR - non-local function
+
+typedef struct { int dummy[10]; } *SUCCESS_FILE, S;
+extern SUCCESS_FILE success_open();
+