https://bugs.llvm.org/show_bug.cgi?id=41153
Bug ID: 41153
Summary: warning: format string is not a string literal with
default parameter
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: mario.kleb...@ime-actia.de
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
The following code produces a warning, which IMHO is wrong:
mkl@C707 ~ $ cat clang-bug.cpp
void Log(const char* str = " ", ...) __attribute__ ((format (printf, 1, 2)));
void Bug()
{
Log();
}
mkl@C707 ~ $ /usr/lib/llvm/9/bin/clang++ -c clang-bug.cpp
warning: format string is not a string literal (potentially insecure)
[-Wformat-security]
note: treat the string as an argument to avoid this
1 warning generated.
mkl@C707 ~ $ /usr/lib/llvm/9/bin/clang++ --version
clang version 9.0.0 (/var/tmp/portage/sys-devel/clang-9999/work/x/y/clang-9999
b4f4320de39f9a7227af0a8374c6739af6969f7a)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/9/bin
mkl@C707 ~ $
The warning doesn’t include a line number and disappears when I add the default
argument to Log().
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs