tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
clang++ vs va_start
When compiling webkit-gtk with clang from the base system (8.99.30,
clang version 7.0.0 (trunk r337282)), I see:
In file included from /scratch/www/webkit-gtk/work/webkitgtk-2.22.5/DerivedSources/WebCore/unified-sources/UnifiedSource297.cpp:6:
/scratch/www/webkit-gtk/work/webkitgtk-2.22.5/Source/WebCore/platform/LocalizedStrings.cpp:70:5: error: cannot pass object of non-trivial type 'WTF::String' through variadic function; call will abort at runtime [-Wnon-pod-varargs]
va_start(arguments, format);
^
/usr/include/stdarg.h:57:28: note: expanded from macro 'va_start'
#define va_start(ap, last) __builtin_va_start((ap), (last))
^
/usr/include/stdarg.h:49:70: note: expanded from macro '__builtin_va_start'
#define __builtin_va_start(ap, last) __builtin_stdarg_start((ap), (last))
^
In file included from /scratch/www/webkit-gtk/work/webkitgtk-2.22.5/DerivedSources/WebCore/unified-sources/UnifiedSource297.cpp:6:
/scratch/www/webkit-gtk/work/webkitgtk-2.22.5/Source/WebCore/platform/LocalizedStrings.cpp:70:5: warning: second argument to 'va_start' is not the last named parameter [-Wvarargs]
/usr/include/stdarg.h:57:28: note: expanded from macro 'va_start'
#define va_start(ap, last) __builtin_va_start((ap), (last))
^
/usr/include/stdarg.h:49:70: note: expanded from macro '__builtin_va_start'
#define __builtin_va_start(ap, last) __builtin_stdarg_start((ap), (last))
^
1 warning and 1 error generated.
The function around line 70 is
String formatLocalizedString(String format, ...)
where String is WTF::String, and line 70 is a plain
va_start(arguments, format);
I can change the line to compile with clang by making it:
va_start(arguments, format.utf8().data());
but that doesn't look right to me because "format.utf8().data()" is
not the actual argument to the function.
The compiler is not completely happy either, it still reports:
In file included from /scratch/www/webkit-gtk/work/webkitgtk-2.22.5/DerivedSources/WebCore/unified-sources/UnifiedSource297.cpp:6:
/scratch/www/webkit-gtk/work/webkitgtk-2.22.5/Source/WebCore/platform/LocalizedStrings.cpp:70:5: warning: second argument to 'va_start' is not the last named parameter [-Wvarargs]
/usr/include/stdarg.h:57:28: note: expanded from macro 'va_start'
#define va_start(ap, last) __builtin_va_start((ap), (last))
^
/usr/include/stdarg.h:49:70: note: expanded from macro '__builtin_va_start'
#define __builtin_va_start(ap, last) __builtin_stdarg_start((ap), (last))
^
but at least the error is gone.
What's the best way to fix this?
Thomas
Home |
Main Index |
Thread Index |
Old Index