[cfe-dev] clang warns on libcxx chrono and string usage of user-defined literals
Yaron Keren
yaron.keren at gmail.com
Tue Oct 1 09:41:26 PDT 2013
I am calling clang using a custom driver, and it seems clang diagnostics
state is different than the command line driver. I'm looking into this
issue now.
This aside, I think that clang turns off all warnings for system include
files, so compiling from the command line effectively hides this warning as
well as potential others.
So the question is wether this is a real issue or not, as the suffixes in
chrono are lacking an underscore but are not user-defined but
system-defined.
Yaron
2013/10/1 Marshall Clow <mclow.lists at gmail.com>
> On Sep 30, 2013, at 11:48 PM, Yaron Keren <yaron.keren at gmail.com> wrote:
>
> Hi,
>
> Trying to compile libcxx using ToT clang results in several warnings such
> as:
>
> libcxx/string:4169:24: warning: user-defined literal suffixes not starting
> with '_' are reserved
> basic_string<char> operator "" s( const char *__str, size_t __len )
>
> libcxx/chrono:955:29: warning: user-defined literal suffixes not starting
> with '_' are reserved
> constexpr chrono::hours operator"" h(unsigned long long __h)
> ^
> debugging, I see Sema::CheckLiteralOperatorDeclaration calling
> NumericLiteralParser::isValidUDSuffix which returns true (valid) for the
> "s" and "h" suffixes. This prevents the second optional part of the
> warning, "no literal will invoke this operator" but not the first one shown
> above.
>
>
> I'm not seeing this at all (on Mac OS).
>
> I just built ToT clang and then built libc++ - no warnings.
> Then I tried just building individual source files from libc++ to check.
> No warnings either.
>
> $ /Sources/LLVM/build/llvm-cmake-nodebug/bin/clang++ --version
> clang version 3.4 (trunk 191753)
> Target: x86_64-apple-darwin12.5.0
> Thread model: posix
> $
> $ cd /Sources/LLVM/libcxx/lib
> $ TRIPLE=-apple- CXX=$LLVM/build/llvm-cmake-nodebug/bin/clang++ ./buildit
> [ output snipped; but no warnings ]
> $
> $ TRIPLE=-apple- CXX=$LLVM/build/llvm-cmake-nodebug/bin/clang++ ./buildit14
> [ buildit14 is a copy of buildit that sets "-std=c++1y" instead of
> "-std=c++11" ]
> [ output snipped; but no warnings ]
> $
> $/Sources/LLVM/build/llvm-cmake-nodebug/bin/clang++ -c -g -Os -arch i386
> -arch x86_64 -nostdinc++ -std=c++11 -fstrict-aliasing -Wall -Wextra
> -Wshadow -Wconversion -Wnewline-eof -Wpadded -Wmissing-prototypes
> -Wstrict-aliasing=2 -Wstrict-overflow=4 -I../include ../src/chrono.cpp
> $
> $ /Sources/LLVM/build/llvm-cmake-nodebug/bin/clang++ -c -g -Os -arch i386
> -arch x86_64 -nostdinc++ -std=c++1y -fstrict-aliasing -Wall -Wextra
> -Wshadow -Wconversion -Wnewline-eof -Wpadded -Wmissing-prototypes
> -Wstrict-aliasing=2 -Wstrict-overflow=4 -I../include ../src/chrono.cpp
> $
>
>
> -- Marshall
>
> Marshall Clow Idio Software <mailto:mclow.lists at gmail.com<mclow.lists at gmail.com>
> >
>
> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is
> promptly moderated down to (-1, Flamebait).
> -- Yu Suzuki
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131001/61981666/attachment.html>
More information about the cfe-dev
mailing list