Changeset 242075 in webkit


Ignore:
Timestamp:
Feb 25, 2019 10:44:06 PM (5 years ago)
Author:
calvaris@igalia.com
Message:

Fix WTFLogVerbose variadic parameters forwarding
https://bugs.webkit.org/show_bug.cgi?id=194920

Reviewed by Alex Christensen.

WTFLogVerbose was passing the va_list to WTFLog but this function
also used variadic parameters and this is not allowed in C (that
part of the code is extern "C").

  • wtf/Assertions.cpp:

(WTF::WTFLogVaList): Created to take a va_list argument instead of
variadic parameters.
(WTF::WTFLog): Kept with variadic parameters, which are
transformed to va_list and passed to WTFLogVaList.
(WTF::WTFLogVerbose): Use WTFLogVaList instead of WTFLog.

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r242048 r242075  
     12019-02-25  Xabier Rodriguez Calvar  <calvaris@igalia.com>
     2
     3        Fix WTFLogVerbose variadic parameters forwarding
     4        https://bugs.webkit.org/show_bug.cgi?id=194920
     5
     6        Reviewed by Alex Christensen.
     7
     8        WTFLogVerbose was passing the va_list to WTFLog but this function
     9        also used variadic parameters and this is not allowed in C (that
     10        part of the code is extern "C").
     11
     12        * wtf/Assertions.cpp:
     13        (WTF::WTFLogVaList): Created to take a va_list argument instead of
     14        variadic parameters.
     15        (WTF::WTFLog): Kept with variadic parameters, which are
     16        transformed to va_list and passed to WTFLogVaList.
     17        (WTF::WTFLogVerbose): Use WTFLogVaList instead of WTFLog.
     18
    1192019-02-25  Sam Weinig  <sam@webkit.org>
    220
  • trunk/Source/WTF/wtf/Assertions.cpp

    r242014 r242075  
    431431}
    432432
    433 void WTFLog(WTFLogChannel* channel, const char* format, ...)
     433static void WTFLogVaList(WTFLogChannel* channel, const char* format, va_list args)
    434434{
    435435    if (channel->state == WTFLogChannelOff)
     
    437437
    438438    if (channel->state == WTFLogChannelOn) {
    439         va_list args;
    440         va_start(args, format);
    441439        vprintf_stderr_with_trailing_newline(format, args);
    442         va_end(args);
    443440        return;
    444441    }
    445442
    446443    ASSERT(channel->state == WTFLogChannelOnWithAccumulation);
    447 
    448     va_list args;
    449     va_start(args, format);
    450444
    451445    ALLOW_NONLITERAL_FORMAT_BEGIN
     
    453447    ALLOW_NONLITERAL_FORMAT_END
    454448
    455     va_end(args);
    456 
    457449    if (!loggingString.endsWith('\n'))
    458450        loggingString.append('\n');
     
    463455}
    464456
     457void WTFLog(WTFLogChannel* channel, const char* format, ...)
     458{
     459    va_list args;
     460    va_start(args, format);
     461
     462    WTFLogVaList(channel, format, args);
     463
     464    va_end(args);
     465}
     466
    465467void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel* channel, const char* format, ...)
    466468{
     
    472474
    473475    ALLOW_NONLITERAL_FORMAT_BEGIN
    474     WTFLog(channel, format, args);
     476    WTFLogVaList(channel, format, args);
    475477    ALLOW_NONLITERAL_FORMAT_END
    476478
Note: See TracChangeset for help on using the changeset viewer.