[committed] Fix -Wstrict-null-sentinel warning (--with-iconv-bin)
Commit Message
[ was: Re: [PATCH 2/2] gdb: Fix a type of sentinel ]
On 30-01-2020 14:58, Lukas Durfina wrote:
> Hello,
>
> To Simon: I will merge both patches into the single one.
I was not aware of this thread, so I've fixed the gdb_environ::set
occurrence in commit 85f0dd3ce8 "[gdb] Fix -Wstrict-null-sentinel warnings".
After seeing this thread and the charset.c occurrence, I realized it
would cause a build breaker when using --with-iconv-bin, now that we
have the warning on-by-default.
So, given the higher urgency, I've committed the patch for charset.c as
well.
Thanks,
- Tom
[gdb] Fix -Wstrict-null-sentinel warning (--with-iconv-bin)
When using configure flag --with-iconv-bin=$(which iconv), we run into:
...
gdb/charset.c: In function 'void find_charset_names()':
gdb/charset.c:821:75: error: missing sentinel in function call [-Werror=format=]
iconv_program = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", NULL);
^
cc1plus: all warnings being treated as errors
...
Fix the warning.
Build and reg-tested on x86_64-linux.
2020-02-12 Lukas Durfina <ldurfina@tachyum.com>
Tom de Vries <tdevries@suse.de>
* charset.c (find_charset_names): Cast concat NULL sentinel to char *.
---
gdb/charset.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
@@ -818,7 +818,8 @@ find_charset_names (void)
{
std::string iconv_dir = relocate_gdb_directory (ICONV_BIN,
ICONV_BIN_RELOCATABLE);
- iconv_program = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", NULL);
+ iconv_program
+ = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", (char *) NULL);
}
#else
iconv_program = xstrdup ("iconv");