New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gcc 3.3 has problems with __attribute__((unused)) #8500
Comments
From jgmyers@proofpoint.comCreated by jgmyers@pong.us.proofpoint.com[jgmyers@pong jgmyers]$ cat test.c Perl Info
|
From guest@guest.guest.xxxxxxxxProposed fix |
The RT System itself - Status changed from 'new' to 'open' |
From @smpetersOn Mon, Jun 26, 2006 at 03:43:35PM -0700, John Gardiner Myers wrote:
What errors specifically do you see when compiling Perl? Steve Peters |
From jgmyers@proofpoint.comSteve Peters via RT wrote:
cc -Isrc -I/usr/lib/perl5/5.8.8/i686-linux-thread-multi/CORE |
From @doughera88On Mon, 26 Jun 2006, John Gardiner Myers wrote:
What's the -x c++ flag there for, and how did it get there? If it was
-- |
From jgmyers@proofpoint.comAndy Dougherty via RT wrote:
|
From @doughera88On Tue, 27 Jun 2006, John Gardiner Myers wrote:
Ah. I'd never heard of Encode::Detect before. So if I understand Hmm. Tricky. While that's certainly surprising and inconvenient For the moment, I think if you just #define PERL_UNUSED_DECL at the top of Longer term, we should probably apply this patch from bleadperl to the Inline Patch--- perl-5.8.x/perl.h 2006-06-27 17:56:06.000000000 -0400
+++ perl-5.8.x-andy/perl.h 2006-06-28 15:09:27.000000000 -0400
@@ -164,7 +164,7 @@
#endif
#ifndef PERL_UNUSED_DECL
-# ifdef HASATTRIBUTE_UNUSED
+# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
# define PERL_UNUSED_DECL __attribute__unused__
# else
# define PERL_UNUSED_DECL
-- |
From jgmyers@proofpoint.comAndrew Dougherty wrote:
That patch has the undesired effect of disabling the use of Neither the patch nor -DPERL_UNUSED_DECL= helps much--the compile then I think my proposed patch is the best one. __attribute__((unused)) is |
From @doughera88On Wed, 28 Jun 2006, John Myers wrote:
Well, this patch is what bleadperl does. Yes, it hits the problem with a
Ah, ok. Then XSUB.h probably needs the same patch. Something like this, Inline Patch--- perl-5.8.x/XSUB.h 2006-06-13 15:30:49.000000000 -0400
+++ perl-5.8.x-andy/XSUB.h 2006-06-29 11:48:32.000000000 -0400
@@ -99,7 +99,7 @@
#if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
# define XS(name) __declspec(dllexport) void name(pTHX_ CV* cv)
#else
-# ifdef HASATTRIBUTE_UNUSED
+# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
# define XS(name) void name(pTHX_ CV* cv __attribute__unused__)
# else
# define XS(name) void name(pTHX_ CV* cv)
What proposed patch? I didn't see one anywhere. -- |
From jgmyers@proofpoint.comAndy Dougherty wrote:
It's much more important for warnings to be suppressed in newer
You'd need to also do that change for any other reference to
The one attached to this bug. And yes, your bug tracking system leaves much to be desired. <http://rt.perl.org/rt3/Ticket/Attachment/135364/90935/perl-attrib.diff> |
From @doughera88On Thu, 29 Jun 2006, Andy Dougherty wrote:
Oh, and I forgot -- a quick workaround is to add #undef -- |
From @doughera88On Thu, 29 Jun 2006, John Myers wrote:
Well, my confusion arose because the C compiler *did* support the feature,
Ah. I hadn't seen that. I had only been following along in the mailing Yes, your patch is probably better overall. I had forgotten about that Nick and Rafael -- I've cc'd you because I think *this* version of the Inline Patch--- perl-5.8.x/perl.h 2006-06-27 17:56:06.000000000 -0400
+++ perl-5.8.x-andy/perl.h 2006-06-29 13:18:25.000000000 -0400
@@ -2442,6 +2442,9 @@
* http://www.ohse.de/uwe/articles/gcc-attributes.html,
* but contrary to this information warn_unused_result seems
* not to be in gcc 3.3.5, at least. --jhi
+ * Also, when building extensions with an installed perl, this allows
+ * the user to upgrade gcc and get the right attributes, rather than
+ * relying on the list generated at Configure time. --AD
* Set these up now otherwise we get confused when some of the <*thread.h>
* includes below indirectly pull in <perlio.h> (which needs to know if we
* have HASATTRIBUTE_FORMAT).
@@ -2463,7 +2466,8 @@
# if __GNUC__ >= 3 /* gcc 3.0 -> */
# define HASATTRIBUTE_PURE
# endif
-# if __GNUC__ >= 3 /* gcc 3.0 -> */ /* XXX Verify this version */
+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
+ /* This actually works for gcc-3.3, but not for g++-3.3. */
# define HASATTRIBUTE_UNUSED
# endif
# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
-- Andy Dougherty doughera@lafayette.edu |
From @TuxOn Thu, 29 Jun 2006 13:41:28 -0400 (EDT), Andrew Dougherty
I'm neither Nicholas, nor Rafael, but applied this patch as
-- |
@smpeters - Status changed from 'open' to 'resolved' |
From @doughera88On Thu, 29 Jun 2006, Andrew Dougherty wrote: [patch already applied to bleadperl] Upon further testing, I think this refinement is in order. It Again, this should be suitable for both bleadperl and maintperl. Inline Patch--- perl-current/perl.h 2006-07-10 07:30:15.000000000 -0400
+++ perl-andy/perl.h 2006-07-10 13:04:38.000000000 -0400
@@ -2604,9 +2604,11 @@
# define HASATTRIBUTE_PURE
# endif
# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
- /* This actually works for gcc-3.3, but not for g++-3.3. */
# define HASATTRIBUTE_UNUSED
# endif
+# if __GNUC__ == 3 && __GNUC_MINOR__ == 3 && !defined(__cplusplus)
+# define HASATTRIBUTE_UNUSED /* gcc-3.3, but not g++-3.3. */
+# endif
# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
# define HASATTRIBUTE_WARN_UNUSED_RESULT
# endif
-- Andy Dougherty doughera@lafayette.edu |
From @rgsAndy Dougherty wrote:
Thanks, applied as change #28541. |
Migrated from rt.perl.org#39634 (status was 'resolved')
Searchable as RT39634$
The text was updated successfully, but these errors were encountered: