<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>27854</bug_id>
          
          <creation_ts>2012-10-16 08:59:20 +0400</creation_ts>
          <short_desc>g++ &lt; 4.3 doesn&apos;t compile unistd.h with -O2 -pedantic</short_desc>
          <delta_ts>2017-10-28 04:35:28 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>glibc-devel</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ivan A. Melnikov">iv</reporter>
          <assigned_to name="Gleb F-Malinovskiy">glebfm</assigned_to>
          <cc>glebfm</cc>
    
    <cc>ldv</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>133960</commentid>
    <comment_count>0</comment_count>
    <who name="Ivan A. Melnikov">iv</who>
    <bug_when>2012-10-16 08:59:20 +0400</bug_when>
    <thetext>Простой пример:

$ cat a.cpp
#include &lt;unistd.h&gt;

int main() { return 0; }

$ g++-4.1 -O2 -pedantic a.cpp
/usr/include/bits/unistd.h: In function ‘int gethostname(char*, size_t)’:
/usr/include/bits/unistd.h:344: error: declaration of ‘int gethostname(char*, size_t) throw ()’ throws different exceptions
/usr/include/unistd.h:901: error: from previous declaration ‘int gethostname(char*, size_t)’
/usr/include/bits/unistd.h: In function ‘int getdomainname(char*, size_t)’:
/usr/include/bits/unistd.h:373: error: declaration of ‘int getdomainname(char*, size_t) throw ()’ throws different exceptions
/usr/include/unistd.h:920: error: from previous declaration ‘int getdomainname(char*, size_t)’

Если убрать -O2 или -pedantic -- работает.

Обнаружил при попытке разобраться, что же случилось с libncursesxx:

http://lists.altlinux.org/pipermail/devel/2012-October/195599.html

$ rpm -qf /usr/include/unistd.h
glibc-devel-2.16-alt4
$ rpm -qf `which g++-4.1`
gcc4.1-c++-4.1.2-alt11</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>133981</commentid>
    <comment_count>1</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2012-10-16 15:23:30 +0400</bug_when>
    <thetext>Не знаю, на что более корректно это повесить, наверное, на glibc-devel.
В g++ &gt;= 4.3 это работает, а фиксить поддержку -O2 -pedantic в старых компиляторах -- это маловероятно.

см. тж. http://sourceware.org/bugzilla/show_bug.cgi?id=14530 и http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b7bfe116e6304da848759b69a6d713da3e93e936</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>166665</commentid>
    <comment_count>2</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2017-10-28 04:35:28 +0300</bug_when>
    <thetext>g++ &lt; 4.3 is irrelevant.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>