[cfe-dev] clang warns on libcxx chrono and string usage of user-defined literals
Marshall Clow
mclow.lists at gmail.com
Tue Oct 1 09:46:39 PDT 2013
On Oct 1, 2013, at 9:41 AM, Yaron Keren <yaron.keren at gmail.com> wrote:
> 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.
I don't think that's true; (the 'all warnings' part), but lang definitely behaves somewhat differently when compiling a system header file.
> 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.
If you're not compiling a system include file, then that's a fine error.
UDL's that do not start with '_' are reserved.
But there has to be a way for libc++ to define them.
I would say that this is not a real issue.
-- Marshall
> 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>
>
> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
> -- Yu Suzuki
>
>
-- Marshall
Marshall Clow Idio Software <mailto: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/aaab4c37/attachment.html>
More information about the cfe-dev
mailing list