From nobody@FreeBSD.org  Fri May 13 22:21:30 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A5FAE1065670
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 13 May 2011 22:21:30 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 7B9058FC15
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 13 May 2011 22:21:30 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DMLUJ7092001
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 13 May 2011 22:21:30 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p4DMLUab092000;
	Fri, 13 May 2011 22:21:30 GMT
	(envelope-from nobody)
Message-Id: <201105132221.p4DMLUab092000@red.freebsd.org>
Date: Fri, 13 May 2011 22:21:30 GMT
From: Pedro Giffuni <giffunip@tutopia.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: gcc: Add some warnings from OpenBSD gcc and fix a typo.
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         157019
>Category:       gnu
>Synopsis:       [patch] gcc(1): Add some warnings from OpenBSD gcc and fix a typo.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    uqs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 13 22:30:08 UTC 2011
>Closed-Date:    Tue Aug 02 09:07:13 UTC 2011
>Last-Modified:  Tue Aug  2 09:10:15 UTC 2011
>Originator:     Pedro Giffuni
>Release:        8.2-Release
>Organization:
>Environment:
FreeBSD mogwai.giffuni.net 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Fri Mar 18 15:35:09 UTC 2011     root@mogwai.giffuni.net:/usr/src/sys/amd64/compile/GENERIC  amd64

>Description:
While looking for some unrelated fixes, I found these simple
patches for gcc-4.2.1 from OpenBSD's tree.

- Implement -Wvariable-decl.
- port -Wtrampolines support from gcc3. (I took out -ftrampolines since it seems excessive for FreeBSD).
- Fix typo in check_for_nested_with_variably_modified present
for 4 years that hampered the inliner without anyone noticing.


>How-To-Repeat:

>Fix:
Patch attached.

Patch attached with submission follows:

--- gcc/c-decl.c	2009/10/15 18:11:28	1.1
+++ gcc/c-decl.c	2010/04/29 19:37:37	1.2
@@ -4256,6 +4256,8 @@ grokdeclarator (const struct c_declarator *declarator,
 			  pedwarn ("ISO C90 forbids variable-size array %qs",
 				   name);
 		      }
+		    if (warn_variable_decl)
+		      warning (0, "variable-sized array %qs", name);
 		  }
 
 		if (integer_zerop (size))
--- gcc/c.opt	2010/05/09 14:09:18	1.2
+++ gcc/c.opt	2010/05/12 14:35:56	1.3
@@ -407,6 +407,10 @@ Wtraditional
 C ObjC Var(warn_traditional)
 Warn about features not present in traditional C
 
+Wtrampolines
+Common Var(warn_trampolines)
+Warn when trampolines are emitted
+
 Wtrigraphs
 C ObjC C++ ObjC++
 Warn if trigraphs are encountered that might affect the meaning of the program
--- gcc/common.opt	2010/04/28 07:27:02	1.4
+++ gcc/common.opt	2010/04/29 19:37:37	1.5
@@ -193,6 +193,10 @@ Wunused-variable
 Common Var(warn_unused_variable)
 Warn when a variable is unused
 
+Wvariable-decl
+Common Var(warn_variable_decl)
+Warn about variable-sized declarations.
+
 Wvolatile-register-var
 Common Var(warn_register_var)
 Warn when a register variable is declared volatile
--- gcc/tree-nested.c	2009/10/15 18:11:28	1.1.1.1
+++ gcc/tree-nested.c	2010/05/12 14:35:56	1.3
@@ -750,7 +750,7 @@ check_for_nested_with_variably_modified (tree fndecl, 
   for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
     {
       for (arg = DECL_ARGUMENTS (cgn->decl); arg; arg = TREE_CHAIN (arg))
-	if (variably_modified_type_p (TREE_TYPE (arg), 0), orig_fndecl)
+	if (variably_modified_type_p (TREE_TYPE (arg), orig_fndecl))
 	  return true;
 
       if (check_for_nested_with_variably_modified (cgn->decl, orig_fndecl))
@@ -1622,6 +1622,15 @@ convert_tramp_reference (tree *tp, int *walk_subtrees,
       if (DECL_NO_STATIC_CHAIN (decl))
 	break;
 
+      if (warn_trampolines) 
+        {
+      	warning(0, "local function address taken needing trampoline generation");
+        }
       /* Lookup the immediate parent of the callee, as that's where
 	 we need to insert the trampoline.  */
       for (i = info; i->context != target_context; i = i->outer)


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: uqs 
State-Changed-When: Mon Jun 27 20:45:10 UTC 2011 
State-Changed-Why:  
Hello Pedro, 

the patch you attached is incomplete/malformed. Could you please 
regenerate and re-send? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157019 
Responsible-Changed-From-To: freebsd-bugs->uqs 
Responsible-Changed-By: uqs 
Responsible-Changed-When: Tue Jun 28 18:22:37 UTC 2011 
Responsible-Changed-Why:  


http://www.freebsd.org/cgi/query-pr.cgi?pr=157019 
State-Changed-From-To: feedback->patched 
State-Changed-By: uqs 
State-Changed-When: Fri Jul 1 20:46:38 UTC 2011 
State-Changed-Why:  
Patched in head 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157019 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: gnu/157019: commit references a PR
Date: Fri,  1 Jul 2011 20:46:11 +0000 (UTC)

 Author: uqs
 Date: Fri Jul  1 20:45:55 2011
 New Revision: 223715
 URL: http://svn.freebsd.org/changeset/base/223715
 
 Log:
   - Fix typo in check_for_nested_with_variably_modified present
   - Implement -Wvariable-decl.
   - Port -Wtrampolines support from gcc3.
   (all three also via OpenBSD)
   
   PR:		gnu/127136, gnu/157019
   Submitted by:	Henning Petersen, Pedro Giffuni
   MFC after:	6 weeks
 
 Modified:
   head/contrib/gcc/c-decl.c
   head/contrib/gcc/c.opt
   head/contrib/gcc/common.opt
   head/contrib/gcc/tree-nested.c
 
 Modified: head/contrib/gcc/c-decl.c
 ==============================================================================
 --- head/contrib/gcc/c-decl.c	Fri Jul  1 19:23:25 2011	(r223714)
 +++ head/contrib/gcc/c-decl.c	Fri Jul  1 20:45:55 2011	(r223715)
 @@ -4340,6 +4340,8 @@ grokdeclarator (const struct c_declarato
  			  pedwarn ("ISO C90 forbids variable-size array %qs",
  				   name);
  		      }
 +		    if (warn_variable_decl)
 +		      warning (0, "variable-sized array %qs", name);
  		  }
  
  		if (integer_zerop (size))
 
 Modified: head/contrib/gcc/c.opt
 ==============================================================================
 --- head/contrib/gcc/c.opt	Fri Jul  1 19:23:25 2011	(r223714)
 +++ head/contrib/gcc/c.opt	Fri Jul  1 20:45:55 2011	(r223715)
 @@ -404,6 +404,10 @@ Wtraditional
  C ObjC Var(warn_traditional)
  Warn about features not present in traditional C
  
 +Wtrampolines
 +Common Var(warn_trampolines)
 +Warn when trampolines are emitted
 +
  Wtrigraphs
  C ObjC C++ ObjC++
  Warn if trigraphs are encountered that might affect the meaning of the program
 
 Modified: head/contrib/gcc/common.opt
 ==============================================================================
 --- head/contrib/gcc/common.opt	Fri Jul  1 19:23:25 2011	(r223714)
 +++ head/contrib/gcc/common.opt	Fri Jul  1 20:45:55 2011	(r223715)
 @@ -189,6 +189,10 @@ Wunused-variable
  Common Var(warn_unused_variable)
  Warn when a variable is unused
  
 +Wvariable-decl
 +Common Var(warn_variable_decl)
 +Warn about variable-sized declarations.
 +
  Wvolatile-register-var
  Common Var(warn_register_var)
  Warn when a register variable is declared volatile
 
 Modified: head/contrib/gcc/tree-nested.c
 ==============================================================================
 --- head/contrib/gcc/tree-nested.c	Fri Jul  1 19:23:25 2011	(r223714)
 +++ head/contrib/gcc/tree-nested.c	Fri Jul  1 20:45:55 2011	(r223715)
 @@ -750,7 +750,7 @@ check_for_nested_with_variably_modified 
    for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
      {
        for (arg = DECL_ARGUMENTS (cgn->decl); arg; arg = TREE_CHAIN (arg))
 -	if (variably_modified_type_p (TREE_TYPE (arg), 0), orig_fndecl)
 +	if (variably_modified_type_p (TREE_TYPE (arg), orig_fndecl))
  	  return true;
  
        if (check_for_nested_with_variably_modified (cgn->decl, orig_fndecl))
 @@ -1621,6 +1621,10 @@ convert_tramp_reference (tree *tp, int *
  	 it doesn't need a trampoline.  */
        if (DECL_NO_STATIC_CHAIN (decl))
  	break;
 +      if (warn_trampolines)
 +	{
 +	warning(0, "local function address taken needing trampoline generation");
 +	}
  
        /* Lookup the immediate parent of the callee, as that's where
  	 we need to insert the trampoline.  */
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: "Pedro F. Giffuni" <giffunip@tutopia.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: gnu/157019: [patch] gcc(1): Add some warnings from OpenBSD gcc and fix a typo.
Date: Wed, 27 Jul 2011 07:26:47 -0700 (PDT)

 This can be closed, I doubt it will be MFC'd.
State-Changed-From-To: patched->closed 
State-Changed-By: uqs 
State-Changed-When: Tue Aug 2 09:06:47 UTC 2011 
State-Changed-Why:  
Merged to stable/8, thanks for your submission! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=157019 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: gnu/157019: commit references a PR
Date: Tue,  2 Aug 2011 09:06:14 +0000 (UTC)

 Author: uqs
 Date: Tue Aug  2 09:06:04 2011
 New Revision: 224600
 URL: http://svn.freebsd.org/changeset/base/224600
 
 Log:
   MFH r223715
   
   - Fix typo in check_for_nested_with_variably_modified
   - Implement -Wvariable-decl.
   - Port -Wtrampolines support from gcc3.
       (all three also via OpenBSD)
   
   PR:		gnu/127136, gnu/157019
   Submitted by:	Henning Petersen, Pedro Giffuni
 
 Modified:
   stable/8/contrib/gcc/c-decl.c
   stable/8/contrib/gcc/c.opt
   stable/8/contrib/gcc/common.opt
   stable/8/contrib/gcc/tree-nested.c
 Directory Properties:
   stable/8/contrib/gcc/   (props changed)
 
 Modified: stable/8/contrib/gcc/c-decl.c
 ==============================================================================
 --- stable/8/contrib/gcc/c-decl.c	Tue Aug  2 08:31:23 2011	(r224599)
 +++ stable/8/contrib/gcc/c-decl.c	Tue Aug  2 09:06:04 2011	(r224600)
 @@ -4340,6 +4340,8 @@ grokdeclarator (const struct c_declarato
  			  pedwarn ("ISO C90 forbids variable-size array %qs",
  				   name);
  		      }
 +		    if (warn_variable_decl)
 +		      warning (0, "variable-sized array %qs", name);
  		  }
  
  		if (integer_zerop (size))
 
 Modified: stable/8/contrib/gcc/c.opt
 ==============================================================================
 --- stable/8/contrib/gcc/c.opt	Tue Aug  2 08:31:23 2011	(r224599)
 +++ stable/8/contrib/gcc/c.opt	Tue Aug  2 09:06:04 2011	(r224600)
 @@ -404,6 +404,10 @@ Wtraditional
  C ObjC Var(warn_traditional)
  Warn about features not present in traditional C
  
 +Wtrampolines
 +Common Var(warn_trampolines)
 +Warn when trampolines are emitted
 +
  Wtrigraphs
  C ObjC C++ ObjC++
  Warn if trigraphs are encountered that might affect the meaning of the program
 
 Modified: stable/8/contrib/gcc/common.opt
 ==============================================================================
 --- stable/8/contrib/gcc/common.opt	Tue Aug  2 08:31:23 2011	(r224599)
 +++ stable/8/contrib/gcc/common.opt	Tue Aug  2 09:06:04 2011	(r224600)
 @@ -189,6 +189,10 @@ Wunused-variable
  Common Var(warn_unused_variable)
  Warn when a variable is unused
  
 +Wvariable-decl
 +Common Var(warn_variable_decl)
 +Warn about variable-sized declarations.
 +
  Wvolatile-register-var
  Common Var(warn_register_var)
  Warn when a register variable is declared volatile
 
 Modified: stable/8/contrib/gcc/tree-nested.c
 ==============================================================================
 --- stable/8/contrib/gcc/tree-nested.c	Tue Aug  2 08:31:23 2011	(r224599)
 +++ stable/8/contrib/gcc/tree-nested.c	Tue Aug  2 09:06:04 2011	(r224600)
 @@ -750,7 +750,7 @@ check_for_nested_with_variably_modified 
    for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
      {
        for (arg = DECL_ARGUMENTS (cgn->decl); arg; arg = TREE_CHAIN (arg))
 -	if (variably_modified_type_p (TREE_TYPE (arg), 0), orig_fndecl)
 +	if (variably_modified_type_p (TREE_TYPE (arg), orig_fndecl))
  	  return true;
  
        if (check_for_nested_with_variably_modified (cgn->decl, orig_fndecl))
 @@ -1621,6 +1621,10 @@ convert_tramp_reference (tree *tp, int *
  	 it doesn't need a trampoline.  */
        if (DECL_NO_STATIC_CHAIN (decl))
  	break;
 +      if (warn_trampolines)
 +	{
 +	warning(0, "local function address taken needing trampoline generation");
 +	}
  
        /* Lookup the immediate parent of the callee, as that's where
  	 we need to insert the trampoline.  */
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
