LLVM 3.4: snprintf() with g++ -std=c++11: error: 'snprintf' was not declared in this scope

Hi

I am building LLVM 3.4 on a cygwin platform
$ uname -a
CYGWIN_NT-6.1 idefix 1.7.28(0.271/5/3) 2014-02-09 21:06 x86_64 Cygwin
$ g++ --version
g++ (GCC) 4.8.2

and got this error from gcc

In file included from
/cygdrive/z/dev/llvm/x64/llvm/lib/Support/BranchProbability.cpp:16:0:
/cygdrive/z/dev/llvm/x64/llvm/include/llvm/Support/Format.h: In
instantiation of ‘int llvm::format_object1<T>::snprint(char*, unsigned int)
const [with T = double]’:
/cygdrive/z/dev/llvm/x64/llvm/lib/Support/BranchProbability.cpp:36:1:
required from here
/cygdrive/z/dev/llvm/x64/llvm/include/llvm/Support/Format.h:87:49: erreur:
‘snprintf’ was not declared in this scope
     return snprintf(Buffer, BufferSize, Fmt, Val);

In the Cygwin mailing list, this thread
"http://cygwin.com/ml/cygwin/2012-04/msg00140.html&quot; explains the problem
that I have reproduced fully and states it could be a bug in gcc . The
proposed workarounds are

1/ use -std=gnu11 which works
2/ explicitly declare int snprintf ( char * s, size_t n, const char *
format, ... );

IMHO, meantime fixing the gcc, I would suggest to keep the c++11 standard
and explicitly declare the signature of snprintf.

Any thought on this issue?

Regards

Hi,

(snip)

'snprintf' was not declared in this scope
     return snprintf(Buffer, BufferSize, Fmt, Val);

In the Cygwin mailing list, this thread
"http://cygwin.com/ml/cygwin/2012-04/msg00140.html&quot; explains the problem
that I have reproduced fully and states it could be a bug in gcc . The
proposed workarounds are

1/ use -std=gnu11 which works
2/ explicitly declare int snprintf ( char * s, size_t n, const char *
format, ... );

This should now be fixed.
http://clang-developers.42468.n3.nabble.com/Re-MinGW-build-does-not-compile-with-C-11-td4038387.html

Csaba