public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* v*printf functions not available with g++ -std=c++0x
@ 2011-08-17 15:05 Ryan Johnson
  2011-08-18 14:34 ` Corinna Vinschen
  0 siblings, 1 reply; 5+ messages in thread
From: Ryan Johnson @ 2011-08-17 15:05 UTC (permalink / raw)
  To: cygwin

Hi all,

I'm using the experimental gcc-4.5 package and hit a strange error: 
c++0x mode suppresses the definition of the v*printf() family of 
functions in stdio.h in c++0x mode. The offending code seems to be:

#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L)
#ifndef _REENT_ONLY
...
int     _EXFUN(vsnprintf, (char *, size_t, const char *, __VALIST)
                _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
...
#endif
#endif

Running `g++ -std=c++0x -dM -E' indicates that __STRICT_ANSI__  is 
defined while _REENT_ONLY and __STDC_VERSION__ are not.

Oddly, functions like _vsnprintf_r are still available for some strange 
reason (aren't they extensions?). I hope this is a bug rather than a 
requirement of the new standard; meanwhile, using std=gnu++0x works 
around the problem.

Ryan


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: v*printf functions not available with g++ -std=c++0x
  2011-08-17 15:05 v*printf functions not available with g++ -std=c++0x Ryan Johnson
@ 2011-08-18 14:34 ` Corinna Vinschen
  2011-08-28  3:36   ` Dave Korn
  2011-08-28 12:39   ` Ryan Johnson
  0 siblings, 2 replies; 5+ messages in thread
From: Corinna Vinschen @ 2011-08-18 14:34 UTC (permalink / raw)
  To: cygwin

On Aug 17 11:04, Ryan Johnson wrote:
> Hi all,
> 
> I'm using the experimental gcc-4.5 package and hit a strange error:
> c++0x mode suppresses the definition of the v*printf() family of
> functions in stdio.h in c++0x mode. The offending code seems to be:
> 
> #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L)
> #ifndef _REENT_ONLY
> ...
> int     _EXFUN(vsnprintf, (char *, size_t, const char *, __VALIST)
>                _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
> ...
> #endif
> #endif
> 
> Running `g++ -std=c++0x -dM -E' indicates that __STRICT_ANSI__  is
> defined while _REENT_ONLY and __STDC_VERSION__ are not.
> 
> Oddly, functions like _vsnprintf_r are still available for some
> strange reason (aren't they extensions?). I hope this is a bug
> rather than a requirement of the new standard; meanwhile, using
> std=gnu++0x works around the problem.

If I try that with Yaakov's 4.5.3 cross compilers, then __STRICT_ANSI__
is not defined with -std=c__0x, unless I also specify `-ansi' on the
command line.  However, there's a weird warning:

  $ i686-pc-cygwin-g++ -std=c++0x -dM -E - < /dev/null | grep ANSI
  cc1: warning: command line option "-std=c++0x" is valid for C++/ObjC++ but not for C

Well, sure, that's why I called g++, not gcc...


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: v*printf functions not available with g++ -std=c++0x
  2011-08-18 14:34 ` Corinna Vinschen
@ 2011-08-28  3:36   ` Dave Korn
  2011-08-29 13:56     ` Corinna Vinschen
  2011-08-28 12:39   ` Ryan Johnson
  1 sibling, 1 reply; 5+ messages in thread
From: Dave Korn @ 2011-08-28  3:36 UTC (permalink / raw)
  To: cygwin

On 18/08/2011 15:33, Corinna Vinschen wrote:

> If I try that with Yaakov's 4.5.3 cross compilers, then __STRICT_ANSI__
> is not defined with -std=c__0x, unless I also specify `-ansi' on the
> command line.  However, there's a weird warning:
> 
>   $ i686-pc-cygwin-g++ -std=c++0x -dM -E - < /dev/null | grep ANSI
>   cc1: warning: command line option "-std=c++0x" is valid for C++/ObjC++ but not for C
> 
> Well, sure, that's why I called g++, not gcc...

  Ah, but without a file extension, it doesn't know what language you're
feeding it; for some reason -std doesn't imply -x.  Compare:

> $ g++-4 -std=c++0x -dM -E - < /dev/null | grep ANSI
> cc1: warning: command line option "-std=c++0x" is valid for C++/ObjC++ but not f
> or C
> 
> $ g++-4 -std=c++0x -x c++ -dM -E - < /dev/null | grep ANSI
> #define __STRICT_ANSI__ 1
> 
> $

    cheers,
      DaveK


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: v*printf functions not available with g++ -std=c++0x
  2011-08-18 14:34 ` Corinna Vinschen
  2011-08-28  3:36   ` Dave Korn
@ 2011-08-28 12:39   ` Ryan Johnson
  1 sibling, 0 replies; 5+ messages in thread
From: Ryan Johnson @ 2011-08-28 12:39 UTC (permalink / raw)
  To: cygwin

On 18/08/2011 10:33 AM, Corinna Vinschen wrote:
> If I try that with Yaakov's 4.5.3 cross compilers, then __STRICT_ANSI__
> is not defined with -std=c__0x, unless I also specify `-ansi' on the
> command line.  However, there's a weird warning:
>
>    $ i686-pc-cygwin-g++ -std=c++0x -dM -E -<  /dev/null | grep ANSI
>    cc1: warning: command line option "-std=c++0x" is valid for C++/ObjC++ but not for C
>
> Well, sure, that's why I called g++, not gcc...
That's just because you read from /dev/null, so it couldn't infer which 
language the input file was. Try it with -x c++ ?

Ryan


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: v*printf functions not available with g++ -std=c++0x
  2011-08-28  3:36   ` Dave Korn
@ 2011-08-29 13:56     ` Corinna Vinschen
  0 siblings, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2011-08-29 13:56 UTC (permalink / raw)
  To: cygwin

On Aug 28 04:36, Dave Korn wrote:
> On 18/08/2011 15:33, Corinna Vinschen wrote:
> 
> > If I try that with Yaakov's 4.5.3 cross compilers, then __STRICT_ANSI__
> > is not defined with -std=c__0x, unless I also specify `-ansi' on the
> > command line.  However, there's a weird warning:
> > 
> >   $ i686-pc-cygwin-g++ -std=c++0x -dM -E - < /dev/null | grep ANSI
> >   cc1: warning: command line option "-std=c++0x" is valid for C++/ObjC++ but not for C
> > 
> > Well, sure, that's why I called g++, not gcc...
> 
>   Ah, but without a file extension, it doesn't know what language you're
> feeding it; for some reason -std doesn't imply -x.  Compare:
> 
> > $ g++-4 -std=c++0x -dM -E - < /dev/null | grep ANSI
> > cc1: warning: command line option "-std=c++0x" is valid for C++/ObjC++ but not f
> > or C
> > 
> > $ g++-4 -std=c++0x -x c++ -dM -E - < /dev/null | grep ANSI
> > #define __STRICT_ANSI__ 1

Uh, thanks.  I didn't even know the -x flag.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-08-29 13:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-17 15:05 v*printf functions not available with g++ -std=c++0x Ryan Johnson
2011-08-18 14:34 ` Corinna Vinschen
2011-08-28  3:36   ` Dave Korn
2011-08-29 13:56     ` Corinna Vinschen
2011-08-28 12:39   ` Ryan Johnson

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).