public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: Florian Weimer via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH 2/2] vfprintf: Unify argument handling in process_arg
Date: Thu, 23 Sep 2021 12:07:28 +0200	[thread overview]
Message-ID: <87tuibsizj.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <87y27owv7l.fsf@igel.home> (Andreas Schwab's message of "Wed, 22 Sep 2021 16:17:34 +0200")

* Andreas Schwab:

> On Sep 22 2021, Florian Weimer via Libc-alpha wrote:
>
>> Instead of checking a pointer argument for NULL, use helper macros
>> defined differently in the non-positional and positional cases.
>> This avoids frequent conditional checks and a GCC 12 warning
>> about comparing pointers against NULL which cannot be NULL.
>
> Ok.
>
>> @@ -1545,8 +1474,28 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap, unsigned int mode_flags)
>>        /* Process current format.  */
>>        while (1)
>>  	{
>> -	  process_arg (((struct printf_spec *) NULL));
>> -	  process_string_arg (((struct printf_spec *) NULL));
>> +#define PROCESS_ARG_INT() va_arg (ap, int)
>> +#define PROCESS_ARG_LONG_INT() va_arg (ap, long int)
>> +#define PROCESS_ARG_LONG_LONG_INT() va_arg (ap, long long int)
>> +#define PROCESS_ARG_POINTER() va_arg (ap, void *)
>> +#define PROCESS_ARG_STRING() va_arg (ap, const char *)
>> +#define PROCESS_ARG_UNSIGNED_INT() va_arg (ap, unsigned int)
>> +#define PROCESS_ARG_UNSIGNED_LONG_INT() va_arg (ap, unsigned long int)
>> +#define PROCESS_ARG_UNSIGNED_LONG_LONG_INT() va_arg (ap, unsigned long long int)
>> +#define PROCESS_ARG_WCHAR_T() va_arg (ap, wchar_t)
>> +#define PROCESS_ARG_WSTRING() va_arg (ap, const wchar_t *)
>
> I think it would be nicer to spell these macros in lower case.

Fair enough, I've renamed the macros to lower case before pushing.

Thanks,
Florian


      reply	other threads:[~2021-09-23 10:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22  7:09 [PATCH 0/2] vfprintf cleanups to avoid -Waddress warning Florian Weimer
2021-09-22  7:10 ` [PATCH 1/2] vfprintf: Handle floating-point cases outside of process_arg macro Florian Weimer
2021-09-22 13:55   ` Andreas Schwab
2021-09-22  7:10 ` [PATCH 2/2] vfprintf: Unify argument handling in process_arg Florian Weimer
2021-09-22 14:17   ` Andreas Schwab
2021-09-23 10:07     ` Florian Weimer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tuibsizj.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).