Message ID | 5372d765-b75f-8d2c-bf0f-e3c0ddc3a802@redhat.com |
---|---|
State | New |
Headers | show |
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> The visual balance of brackets is appealing as well, so I can't say
Pedro> I have a strong preference either way. If you've been converting things
Pedro> already, you'll have a better judgment, so I'll defer to you.
I haven't really converted much, just what you saw on the branch.
I suspect using some kind of paired brackets will make it a little
harder to forget to close the style. But probably only a little. Also
I guess we could add asserts to check that the closing parameter is
always null.
Pedro> If we went the always-%pS way, I had written the patch and it'd
Pedro> look like this:
This is fine by me too.
Tom
diff --git a/gdb/common/format.c b/gdb/common/format.c index 177f79afee3..6fcbaba290d 100644 --- a/gdb/common/format.c +++ b/gdb/common/format.c @@ -259,7 +259,6 @@ format_pieces::format_pieces (const char **arg, bool gdb_extensions) case 's': case 'S': case 'F': - case 'N': f++; break; } diff --git a/gdb/ui-out.c b/gdb/ui-out.c index d50fb3a3e3f..25efa98d56a 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -618,11 +618,14 @@ ui_out::vmessage (const char *format, va_list args) } break; case 'S': - style = *va_arg (args, const ui_file_style *); - break; - case 'N': - va_arg (args, void *); - style = {}; + { + const ui_file_style *style_p + = va_arg (args, const ui_file_style *); + if (style_p != nullptr) + style = *style_p; + else + style = {}; + } break; default: call_do_message (style, current_substring, va_arg (args, void *));