bugGNU gettext - Bugs: bug #35313, autosprintf.h breaks standard...

 
 

bug #35313: autosprintf.h breaks standard headers with -std=c++(98|0x)

Submitted by:  None
Submitted on:  Sun 15 Jan 2012 12:50:38 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Miguel Ángel Arruga Vivas <m1gu3l>
Open/Closed: Closed

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 08 Mar 2013 09:12:32 AM UTC, comment #3:

Miguel's patch pushed.

Daiki Ueno <ueno>
Project Administrator
Fri 01 Mar 2013 08:12:06 PM UTC, comment #2:

It can be tested at https://github.com/644rosen/gettext_gtkbuilder_support.git

Miguel Ángel Arruga Vivas <m1gu3l>
Project MemberIn charge of this item.
Tue 29 Jan 2013 06:26:32 PM UTC, comment #1:

http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html

Also, a header included below autosprintf.h or even the code may want to use the compiler "__attribute__" , not the autosprintf.h definition.

Miguel Ángel Arruga Vivas <m1gu3l>
Project MemberIn charge of this item.
Sun 15 Jan 2012 12:50:38 PM UTC, original submission:

The following piece of code:
-----8<-----
#include <autosprintf.h>
int main() {return 0;}
----->8-----

compiled with:
$ g++ -std=c++98 -Wall -Werror foo.cc

yields the following warnings (which got turned into errors):
-----8<-----
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:118:1: error: ‘int __gthrw_pthread_once(pthread_once_t, void ()())’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:119:1: error: ‘void* __gthrw_pthread_getspecific(pthread_key_t) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:120:1: error: ‘int __gthrw_pthread_setspecific(pthread_key_t, const void*) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:122:1: error: ‘int __gthrw_pthread_create(pthread_t, const pthread_attr_t, void* ()(void), void*) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:123:1: error: ‘int __gthrw_pthread_join(pthread_t, void**)’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:124:1: error: ‘int __gthrw_pthread_equal(pthread_t, pthread_t) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:125:1: error: ‘pthread_t __gthrw_pthread_self() throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:126:1: error: ‘int __gthrw_pthread_detach(pthread_t) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:128:1: error: ‘int __gthrw_pthread_cancel(pthread_t)’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:130:1: error: ‘int __gthrw_sched_yield() throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:132:1: error: ‘int __gthrw_pthread_mutex_lock(pthread_mutex_t*) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:133:1: error: ‘int __gthrw_pthread_mutex_trylock(pthread_mutex_t*) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:136:1: error: ‘int __gthrw_pthread_mutex_timedlock(pthread_mutex_t, const timespec) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:139:1: error: ‘int __gthrw_pthread_mutex_unlock(pthread_mutex_t*) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:140:1: error: ‘int __gthrw_pthread_mutex_init(pthread_mutex_t, const pthread_mutexattr_t) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:141:1: error: ‘int __gthrw_pthread_mutex_destroy(pthread_mutex_t*) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:143:1: error: ‘int __gthrw_pthread_cond_broadcast(pthread_cond_t*) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:144:1: error: ‘int __gthrw_pthread_cond_signal(pthread_cond_t*) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:145:1: error: ‘int __gthrw_pthread_cond_wait(pthread_cond_t, pthread_mutex_t)’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:146:1: error: ‘int __gthrw_pthread_cond_timedwait(pthread_cond_t, pthread_mutex_t, const timespec*)’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:147:1: error: ‘int __gthrw_pthread_cond_destroy(pthread_cond_t*) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:150:1: error: ‘int __gthrw_pthread_key_create(pthread_key_t, void ()(void*)) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:151:1: error: ‘int __gthrw_pthread_key_delete(pthread_key_t) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:152:1: error: ‘int __gthrw_pthread_mutexattr_init(pthread_mutexattr_t*) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:153:1: error: ‘int __gthrw_pthread_mutexattr_settype(pthread_mutexattr_t*, int) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
/usr/include/c++/4.6/x86_64-linux-gnu/./bits/gthr-default.h:154:1: error: ‘int __gthrw_pthread_mutexattr_destroy(pthread_mutexattr_t*) throw ()’ declared ‘static’ but never defined [-Werror=unused-function]
cc1plus: all warnings being treated as errors
----->8-----

A quick workaround is:
-----8<-----
--- foo.cc 2012-01-15 20:33:04.514366708 +0800
+++ foo.new.cc 2012-01-15 20:35:37.518592500 +0800
@@ -1,2 +1,4 @@
+#include <iostream>
+#include <string>
 #include <autosprintf.h>
 int main () {return 0;}
----->8-----

As for why it's happening: autosprintf.h has the following snippet of code which breaks _attribute_ which is used internally by libstdc++.
-----8<-----
#ifndef _attribute_
/* This feature is available in gcc versions 2.5 and later. */
# if _GNUC_ < 2 || (_GNUC_ == 2 && _GNUC_MINOR_ < 5) || _STRICT_ANSI_
# define _attribute_(Spec) /* empty */
# endif
/* The __-protected variants of `format' and `printf' attributes
   are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
# if _GNUC_ < 2 || (_GNUC_ == 2 && _GNUC_MINOR_ < 7)
# define _format_ format
# define _printf_ printf
# endif
#endif
----->8-----

The attached patch fixes the issue.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by ueno (Posted a comment)
  • -unavailable- added by m1gu3l (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 08 Mar 2013 09:12:32 AM UTCuenoStatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Fri 01 Mar 2013 08:12:06 PM UTCm1gu3lStatusIn Progress=>Ready For Test
    Thu 28 Feb 2013 09:56:29 AM UTCm1gu3lStatusNone=>In Progress
      Assigned toNone=>m1gu3l
    Sun 15 Jan 2012 12:50:38 PM UTCNoneAttached File-=>Added 0001-Fix-__attribute__-breakage-with-__STRICT_ANSI__.patch, #24826

    Back to the top


    Powered by Savane 3.1-cleanup