Article View: comp.unix.programmer
Article #3653Re: argp error during include
From: Paulo Matos
Date: Wed, 18 Jan 2006 17:21
Date: Wed, 18 Jan 2006 17:21
75 lines
3926 bytes
3926 bytes
GOT IT!
Found the problem. The -O2 in conjuction with -pedantic generates the
error. Seems I'll drop -pedantic. :)
Cheers,
Paulo Matos
Paulo Matos escreveu:
> Maxim Yegorushkin escreveu:
>
> > Paulo Matos wrote:
> > > Hi all,
> > >
> > > I'm using argp and when I finally try to compile my C++ prog I get:
> > > /usr/include/argp.h: In function `void argp_usage(const argp_state*)':
> > > /usr/include/argp.h:565: error: declaration of `void argp_usage(const
> > > argp_state*) throw ()' throws different exceptions
> > > /usr/include/argp.h:502: error: than previous declaration `void
> > > argp_usage(const argp_state*)'
> > >
> > > I'm using g++ 3.3.4, glibc 2.3.5 and compiling with -Wall -std=c++98.
> > >
> > > Any ideas why this is happening? Using extern "C" { #include <argp.h> }
> > > won't help. :(
> >
> > The error says that the two declarations are not the same.
> >
> > The declaration
> >
> > void argp_usage(const argp_state*);
> >
> > is essentially a short form of
> >
> > void argp_usage(const argp_state*) throw(...);
> >
> > which is not the same as
> >
> > void argp_usage(const argp_state*) throw ();
> >
> > There must be something wrong with the header file or more likely with
> > preprocessor definitions.
>
> Indeed this is a strange issue. I can work out simple examples with
> argp but in my program just blows. While trying to compile a bison
> generated parser which indirectly includes argp with the following
> flags (most added automaticly by autoconf/automake, do I need to have
> anything for argp in configure.ac?):
> g++ -DHAVE_CONFIG_H -I. -I. -I.. -ansi -std=c++98 -pedantic -Wall
> -ggdb -I./include "-DBUILDDATE=\"`date +'%Y-%b-%d %R'`\"" -DESATLOG=5
> -g -O2 -MT msat-parser.o -MD -MP -MF ".deps/msat-parser.Tpo" -c -o
> msat-parser.pre msat-parser.cc
>
> if I change -c to -E and check the preprocessed file I get the
> following line where the warning shows up:
> 502: extern void argp_usage (const struct argp_state *__state);
> 503: extern void __argp_usage (const struct argp_state *__state);
>
> ...
>
> # 563 "/usr/include/argp.h" 3 4
> extern __inline__ void
> argp_usage (const struct argp_state *__state) throw ()
> {
> argp_state_help (__state, stderr, (0x02 | 0x04 | 0x100));
> }
>
> Can it be because of inline? Is there any known issue on argp with
> flex/bison or autoconf/automake specifics for argp?
>
> Cheers,
>
> Paulo Matos
Technical Details
Message-ID:
<1137604869.990727.3600@g43g2000cwa.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!g43g2000cwa.googlegroups.com!not-for-mailReferences:
<1137585686.306568.98560@g43g2000cwa.googlegroups.com> <1137592233.275366.302620@g44g2000cwa.googlegroups.com> <1137595130.891392.73920@g14g2000cwa.googlegroups.com>Show Full Headers
Complete Article Headers
X-Google-Thread: fc89c,6669ff3009cf0fc7 X-Google-Thread: 1029e6,5fb247b3711ce2d2 X-Google-Attributes: gidfc89c,gid1029e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!g43g2000cwa.googlegroups.com!not-for-mail From: "Paulo Matos" <pocmatos@gmail.com> Newsgroups: comp.unix.programmer,gnu.glibc.bug Subject: Re: argp error during include Date: 18 Jan 2006 09:21:10 -0800 Organization: http://groups.google.com Lines: 76 Message-ID: <1137604869.990727.3600@g43g2000cwa.googlegroups.com> References: <1137585686.306568.98560@g43g2000cwa.googlegroups.com> <1137592233.275366.302620@g44g2000cwa.googlegroups.com> <1137595130.891392.73920@g14g2000cwa.googlegroups.com> NNTP-Posting-Host: 193.136.128.7 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1137604875 13754 127.0.0.1 (18 Jan 2006 17:21:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 18 Jan 2006 17:21:15 +0000 (UTC) In-Reply-To: <1137595130.891392.73920@g14g2000cwa.googlegroups.com> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; rv:1.8) Gecko/20060109 Firefox/1.5,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 proxy4.ist.utl.pt:3128 (squid/2.5.STABLE9) Complaints-To: groups-abuse@google.com Injection-Info: g43g2000cwa.googlegroups.com; posting-host=193.136.128.7; posting-account=2leFNA0AAAD88O4z1QQzh4tJjynexjy7