public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: GCC Mailing List <gcc@gcc.gnu.org>,
	Mike Stump <mikestump@comcast.net>,
	       iain@codesourcery.com,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [patch] fix _OBJC_Module defined but not used warning
Date: Sun, 07 Jun 2015 13:08:00 -0000	[thread overview]
Message-ID: <55742CFB.2060209@redhat.com> (raw)
In-Reply-To: <m2k2vf253a.fsf@linux-m68k.org>

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

On 06/07/2015 06:19 AM, Andreas Schwab wrote:
> Another fallout:
>
> FAIL: obj-c++.dg/try-catch-5.mm -fgnu-runtime (test for excess errors)
> Excess errors:
> <built-in>: warning: '_OBJC_Module' defined but not used [-Wunused-variable]

check_global_declarations is called for more symbols now.  All the 
defined but not used errors I've seen in development have been 
legitimate.  For tests, the tests should be fixed.  For built-ins such 
as these, does the attached fix the problem?

It is up to the objc maintainers, we can either fix this with the 
attached patch, or setting DECL_IN_SYSTEM_HEADER.

/* Nonzero for a given ..._DECL node means that no warnings should be
    generated just because this node is unused.  */
#define DECL_IN_SYSTEM_HEADER(NODE) \
   (in_system_header_at (DECL_SOURCE_LOCATION (NODE)))

Let me know what you prefer.
Aldy

[-- Attachment #2: curr --]
[-- Type: text/plain, Size: 855 bytes --]

commit 25ce72372f7b1309004b87810140573b422e1355
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Sun Jun 7 07:32:12 2015 -0400

    	* objc-runtime-shared-support.c (build_module_descriptor): Set
    	TREE_USED on UOBJC_MODULES_decl.

diff --git a/gcc/objc/objc-runtime-shared-support.c b/gcc/objc/objc-runtime-shared-support.c
index d9b3c27..1bcb14a 100644
--- a/gcc/objc/objc-runtime-shared-support.c
+++ b/gcc/objc/objc-runtime-shared-support.c
@@ -519,6 +519,9 @@ build_module_descriptor (long vers, tree attr)
      is referenced by the runtime and, therefore, needed.  */
   DECL_PRESERVE_P (UOBJC_MODULES_decl) = 1;
 
+  /* Squash `defined but not used' warning.  */
+  TREE_USED (UOBJC_MODULES_decl) = 1;
+
   /* Allow the runtime to mark meta-data such that it can be assigned to target
      specific sections by the back-end.  */
   if (attr)

       reply	other threads:[~2015-06-07 11:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5571F319.205@redhat.com>
     [not found] ` <m2k2vf253a.fsf@linux-m68k.org>
2015-06-07 13:08   ` Aldy Hernandez [this message]
2015-06-07 14:37     ` Andreas Schwab
2015-06-08  8:05     ` Iain Sandoe
2015-06-08 10:27       ` Aldy Hernandez
     [not found] ` <m2sia5p3ne.fsf@linux-m68k.org>
     [not found]   ` <55745D42.1000709@redhat.com>
     [not found]     ` <EC191B3F-2503-4979-8C6E-FD8868C3AD84@gmail.com>
     [not found]       ` <55746A85.8010208@redhat.com>
     [not found]         ` <B1EA82B7-CC5D-430B-88ED-00649931ADF8@gmail.com>
2015-06-08  4:18           ` debug-early branch merged into mainline Aldy Hernandez
2015-06-08  8:45             ` Richard Biener
2015-06-08 12:05               ` Aldy Hernandez
2015-06-08 13:32                 ` Richard Biener
2015-06-08 17:29                   ` Aldy Hernandez
2015-06-08 19:24                     ` Richard Biener
2015-06-08 20:33                       ` Aldy Hernandez
2015-06-09  8:08                         ` Richard Biener
2015-06-09  9:47                           ` Aldy Hernandez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55742CFB.2060209@redhat.com \
    --to=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=iain@codesourcery.com \
    --cc=mikestump@comcast.net \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).