[cfe-commits] r137903 - in /cfe/trunk: include/clang/Basic/Builtins.def include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/Sema.h lib/Sema/SemaChecking.cpp test/Sema/warn-strlcpycat-size.c

Ted Kremenek kremenek at apple.com
Wed Aug 17 19:21:18 PDT 2011


I've gone and reverted the change, pending a fix to get it working on Windows.

I think the crux of the matter is the definition of strlen, strlcpy, and strlcat as built-ins, and that not being compatible with how they are defined on Windows.

If possible, could you provide me those definitions from Windows?  Thanks.

Ted

On Aug 17, 2011, at 5:06 PM, NAKAMURA Takumi wrote:

> 2011/8/18 Ted Kremenek <kremenek at apple.com>:
>> Author: kremenek
>> Date: Wed Aug 17 18:40:36 2011
>> New Revision: 137903
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=137903&view=rev
>> Log:
>> Add experimental -Wstrlcpy-size warning that looks to see if the size argument for strlcpy/strlcat is the size of the *source*, and not the size of the *destination*.  This warning is off by default (for now).
>> 
>> Warning logic provided by Geoff Keating.
>> 
>> Added:
>>    cfe/trunk/test/Sema/warn-strlcpycat-size.c
>> Modified:
>>    cfe/trunk/include/clang/Basic/Builtins.def
>>    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>    cfe/trunk/include/clang/Sema/Sema.h
>>    cfe/trunk/lib/Sema/SemaChecking.cpp
>> 
>> Modified: cfe/trunk/include/clang/Basic/Builtins.def
> 
> msvc10 builder reported as below;
> 
>  ******************** TEST 'Clang :: Sema/warn-strlcpycat-size.c'
> FAILED ********************
>  Script:
>  --
>  E:/bb-win7/cmake-clang-i686-msvc10/build/bin/Release/clang.EXE -cc1
> -Wstrlcpy-size -verify -fsyntax-only
> E:\bb-win7\cmake-clang-i686-msvc10\llvm-project\llvm\tools\clang\test\Sema\warn-strlcpycat-size.c
>  --
>  Exit Code: 1
>  Command Output (stdout):
>  --
>  Command 0: "E:/bb-win7/cmake-clang-i686-msvc10/build/bin/Release/clang.EXE"
> "-cc1" "-Wstrlcpy-size" "-verify" "-fsyntax-only"
> "E:\bb-win7\cmake-clang-i686-msvc10\llvm-project\llvm\tools\clang\test\Sema\warn-strlcpycat-size.c"
>  Command 0 Result: 1
>  Command 0 Output:
> 
> 
>  Command 0 Stderr:
> CUSTOMBUILD : error : 'warning' diagnostics seen but not expected:
> [e:\bb-win7\cmake-clang-i686-msvc10\build\tools\clang\test\clang-test.vcxproj]
>    Line 4: incompatible redeclaration of library function 'strlcpy'
>    Line 5: incompatible redeclaration of library function 'strlcat'
>    Line 6: incompatible redeclaration of library function 'strlen'
> CUSTOMBUILD : error : 'warning' diagnostics expected but not seen:
> [e:\bb-win7\cmake-clang-i686-msvc10\build\tools\clang\test\clang-test.vcxproj]
>    Line 22: size argument in 'strlcpy' call appears to be size of the
> source; expected the size of the destination
>    Line 23: size argument in 'strlcpy' call appears to be size of the
> source; expected the size of the destination
>    Line 24: size argument in 'strlcat' call appears to be size of the
> source; expected the size of the destination
>    Line 25: size argument in 'strlcpy' call appears to be size of the
> source; expected the size of the destination
>    Line 26: size argument in 'strlcpy' call appears to be size of the
> source; expected the size of the destination
>    Line 27: size argument in 'strlcpy' call appears to be size of the
> source; expected the size of the destination
> CUSTOMBUILD : error : 'note' diagnostics seen but not expected:
> [e:\bb-win7\cmake-clang-i686-msvc10\build\tools\clang\test\clang-test.vcxproj]
>    Line 4: 'strlcpy' is a builtin with type 'unsigned int (char *,
> const char *, unsigned int)'
>    Line 5: 'strlcat' is a builtin with type 'unsigned int (char *,
> const char *, unsigned int)'
>    Line 6: 'strlen' is a builtin with type 'unsigned int (const char *)'
> CUSTOMBUILD : error : 'note' diagnostics expected but not seen:
> [e:\bb-win7\cmake-clang-i686-msvc10\build\tools\clang\test\clang-test.vcxproj]
>    Line 22: change size argument to be the size of the destination
>    Line 23: change size argument to be the size of the destination
>    Line 24: change size argument to be the size of the destination
>    Line 25: change size argument to be the size of the destination
>    Line 26: change size argument to be the size of the destination
>  17 errors generated.
> 
> 
>  --
> 
>  ********************




More information about the cfe-commits mailing list