public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: Jeff Law <law@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: RFA: PR 66655: Use COFF/PE weak symbols
Date: Thu, 07 Jan 2016 12:15:00 -0000	[thread overview]
Message-ID: <568E56DF.5080601@redhat.com> (raw)
In-Reply-To: <568C149D.6050602@redhat.com>

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

Hi Jeff,


>> The attached patch adds the test derived from the BZ.  There is one
>> small problem - I could not find a way to stop the additional source
>> file from being compiled as a test on its own.

> I think for C++ code it's usually worked around by naming the
> additional-source file with ".cc" rather than .C.  Can you give that a
> quick whirl and see if that avoids having the additional file used as a
> a test on its own?

Thanks - that worked. :-)

Revised test attached.  OK to apply ?

Cheers
   Nick


[-- Attachment #2: pr66655.test.patch --]
[-- Type: text/x-patch, Size: 937 bytes --]

--- /dev/null	2016-01-07 09:30:14.144966933 +0000
+++ gcc/testsuite/g++.dg/pr66655.C	2016-01-07 12:13:15.757187619 +0000
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-additional-sources "pr66655_1.cc" } */
+
+#include "pr66655.h"
+
+extern "C" void abort (void);
+
+#define COOKIE 0xabcd0123
+
+int
+g (void)
+{
+  return COOKIE;
+}
+
+extern int f (void);
+
+int
+main (void)
+{
+  S::set(0);
+  if (f () != COOKIE)
+    abort ();
+  return 0;
+}
--- /dev/null	2016-01-07 09:30:14.144966933 +0000
+++ gcc/testsuite/g++.dg/pr66655_1.cc	2016-01-07 12:04:30.586623022 +0000
@@ -0,0 +1,14 @@
+#include "pr66655.h"
+
+extern int g (void);
+
+int S::i;
+
+int
+f (void)
+{
+  int ret = g ();
+
+  S::set (ret);
+  return ret;
+}
--- /dev/null	2016-01-07 09:30:14.144966933 +0000
+++ gcc/testsuite/g++.dg/pr66655.h	2016-01-05 10:41:45.629561622 +0000
@@ -0,0 +1,5 @@
+struct S
+{
+  static int i;
+  static void set (int ii) { i = -ii; }
+};

  reply	other threads:[~2016-01-07 12:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22 10:17 Nick Clifton
2016-01-02  5:29 ` Jeff Law
2016-01-05 11:03   ` Nick Clifton
2016-01-05 19:08     ` Jeff Law
2016-01-07 12:15       ` Nick Clifton [this message]
2016-01-07 16:44         ` Jeff Law

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=568E56DF.5080601@redhat.com \
    --to=nickc@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    /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).