Files
MINGW-packages/mingw-w64-clang/0505-use-gnu-printf.patch
Alexey Pavlov 85a6ffa028 clang: More gnu_printf fixes. Fix LLDB python module generation. Disable
LLDB python module as swig rewrite liblldb.dll
2018-06-05 12:51:05 +03:00

396 lines
15 KiB
Diff

--- lldb/include/lldb/API/SBError.h.orig 2018-06-05 08:30:11.399418500 +0300
+++ lldb/include/lldb/API/SBError.h 2018-06-05 08:30:01.919405200 +0300
@@ -45,7 +45,11 @@
void SetErrorString(const char *err_str);
int SetErrorStringWithFormat(const char *format, ...)
- __attribute__((format(printf, 2, 3)));
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
+ __attribute__((format(printf, 2, 3)));
+#endif
bool IsValid() const;
--- lldb/include/lldb/API/SBStream.h.orig 2018-06-04 15:17:43.783676100 +0300
+++ lldb/include/lldb/API/SBStream.h 2018-06-04 15:18:13.593255500 +0300
@@ -35,7 +35,12 @@
// accessor.
size_t GetSize();
- void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
+ void Printf(const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
+ __attribute__((format(printf, 2, 3)));
+#endif
void RedirectToFile(const char *path, bool append);
--- lldb/include/lldb/Core/Module.h.orig 2018-06-04 14:50:08.803955100 +0300
+++ lldb/include/lldb/Core/Module.h 2018-06-04 14:50:26.244785800 +0300
@@ -943,21 +943,41 @@
// and log messages on
// their own and keeps the output a bit more consistent.
void LogMessage(Log *log, const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 3, 4)));
+#else
__attribute__((format(printf, 3, 4)));
+#endif
void LogMessageVerboseBacktrace(Log *log, const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 3, 4)));
+#else
__attribute__((format(printf, 3, 4)));
+#endif
void ReportWarning(const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
__attribute__((format(printf, 2, 3)));
+#endif
void ReportError(const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
__attribute__((format(printf, 2, 3)));
+#endif
// Only report an error once when the module is first detected to be modified
// so we don't spam the console with many messages.
void ReportErrorIfModifyDetected(const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
__attribute__((format(printf, 2, 3)));
+#endif
//------------------------------------------------------------------
// Return true if the file backing this module has changed since the
--- lldb/include/lldb/Expression/DiagnosticManager.h.orig 2018-06-04 14:21:56.812767900 +0300
+++ lldb/include/lldb/Expression/DiagnosticManager.h 2018-06-04 14:23:27.698128000 +0300
@@ -131,7 +131,11 @@
void CopyDiagnostics(DiagnosticManager &otherDiagnostics);
size_t Printf(DiagnosticSeverity severity, const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 3, 4)));
+#else
__attribute__((format(printf, 3, 4)));
+#endif
size_t PutString(DiagnosticSeverity severity, llvm::StringRef str);
void AppendMessageToDiagnostic(llvm::StringRef str) {
--- lldb/include/lldb/Interpreter/CommandReturnObject.h.orig 2018-06-04 14:15:54.233202300 +0300
+++ lldb/include/lldb/Interpreter/CommandReturnObject.h 2018-06-04 14:23:36.356143200 +0300
@@ -98,21 +98,33 @@
void AppendMessage(llvm::StringRef in_string);
void AppendMessageWithFormat(const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
__attribute__((format(printf, 2, 3)));
+#endif
void AppendRawWarning(llvm::StringRef in_string);
void AppendWarning(llvm::StringRef in_string);
void AppendWarningWithFormat(const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
__attribute__((format(printf, 2, 3)));
+#endif
void AppendError(llvm::StringRef in_string);
void AppendRawError(llvm::StringRef in_string);
void AppendErrorWithFormat(const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
__attribute__((format(printf, 2, 3)));
+#endif
template <typename... Args>
void AppendMessageWithFormatv(const char *format, Args &&... args) {
--- lldb/include/lldb/Host/Host.h.orig 2018-06-04 14:24:50.371483400 +0300
+++ lldb/include/lldb/Host/Host.h 2018-06-04 14:25:08.420715100 +0300
@@ -111,7 +111,11 @@
enum SystemLogType { eSystemLogWarning, eSystemLogError };
static void SystemLog(SystemLogType type, const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
__attribute__((format(printf, 2, 3)));
+#endif
static void SystemLog(SystemLogType type, const char *format, va_list args);
--- lldb/include/lldb/Target/Process.h.orig 2018-06-05 08:39:22.591558900 +0300
+++ lldb/include/lldb/Target/Process.h 2018-06-05 08:40:05.756918500 +0300
@@ -2882,7 +2882,12 @@
/// printf style format string
//------------------------------------------------------------------
void PrintWarning(uint64_t warning_type, const void *repeat_key,
- const char *fmt, ...) __attribute__((format(printf, 4, 5)));
+ const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 4, 5)));
+#else
+ __attribute__((format(printf, 4, 5)));
+#endif
//------------------------------------------------------------------
// NextEventAction provides a way to register an action on the next
--- lldb/include/lldb/Utility/Log.h.orig 2018-06-04 14:10:38.793247600 +0300
+++ lldb/include/lldb/Utility/Log.h 2018-06-04 14:11:34.547745600 +0300
@@ -140,17 +140,37 @@
Format(file, function, llvm::formatv(format, std::forward<Args>(args)...));
}
- void Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
+ void Printf(const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
+ __attribute__((format(printf, 2, 3)));
+#endif
void VAPrintf(const char *format, va_list args);
- void Error(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
+ void Error(const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
+ __attribute__((format(printf, 2, 3)));
+#endif
void VAError(const char *format, va_list args);
- void Verbose(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
-
- void Warning(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
+ void Verbose(const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
+ __attribute__((format(printf, 2, 3)));
+#endif
+
+ void Warning(const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
+ __attribute__((format(printf, 2, 3)));
+#endif
const Flags GetOptions() const;
--- lldb/include/lldb/Utility/Status.h.orig 2018-06-04 14:20:18.124193200 +0300
+++ lldb/include/lldb/Utility/Status.h 2018-06-04 14:32:48.773124400 +0300
@@ -74,7 +74,11 @@
/* implicit */ Status(std::error_code EC);
explicit Status(const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
__attribute__((format(printf, 2, 3)));
+#endif
Status(const Status &rhs);
//------------------------------------------------------------------
@@ -157,8 +161,12 @@
void SetExpressionError(lldb::ExpressionResults, const char *mssg);
- int SetExpressionErrorWithFormat(lldb::ExpressionResults, const char *format,
- ...) __attribute__((format(printf, 3, 4)));
+ int SetExpressionErrorWithFormat(lldb::ExpressionResults, const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 3, 4)));
+#else
+ __attribute__((format(printf, 3, 4)));
+#endif
//------------------------------------------------------------------
/// Set accesssor with an error value and type.
@@ -212,7 +220,11 @@
/// A printf style format string
//------------------------------------------------------------------
int SetErrorStringWithFormat(const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
__attribute__((format(printf, 2, 3)));
+#endif
int SetErrorStringWithVarArg(const char *format, va_list args);
--- lldb/include/lldb/Utility/Timer.h.orig 2018-06-04 14:34:45.354529600 +0300
+++ lldb/include/lldb/Utility/Timer.h 2018-06-04 14:35:15.134981900 +0300
@@ -42,7 +42,11 @@
/// Default constructor.
//--------------------------------------------------------------
Timer(Category &category, const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 3, 4)));
+#else
__attribute__((format(printf, 3, 4)));
+#endif
//--------------------------------------------------------------
/// Destructor
--- lldb/include/lldb/Utility/Stream.h.orig 2018-06-04 14:02:09.988345600 +0300
+++ lldb/include/lldb/Utility/Stream.h 2018-06-04 14:08:43.729844300 +0300
@@ -121,7 +121,11 @@
/// The number of bytes that were appended to the stream.
//------------------------------------------------------------------
size_t PrintfAsRawHex8(const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((__format__(gnu_printf, 2, 3)));
+#else
__attribute__((__format__(__printf__, 2, 3)));
+#endif
//------------------------------------------------------------------
/// Format a C string from a printf style format and variable
@@ -461,7 +465,12 @@
/// Variable arguments that are needed for the printf style
/// format string \a format.
//------------------------------------------------------------------
- size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
+ size_t Printf(const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
+ __attribute__((format(printf, 2, 3)));
+#endif
size_t PrintfVarArg(const char *format, va_list args);
--- lldb/source/Core/IOHandler.cpp.orig 2018-06-05 08:33:45.759718600 +0300
+++ lldb/source/Core/IOHandler.cpp 2018-06-05 08:34:35.229997100 +0300
@@ -997,7 +997,13 @@
}
}
- void Printf(const char *format, ...) __attribute__((format(printf, 2, 3))) {
+ void Printf(const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
+ __attribute__((format(printf, 2, 3)));
+#endif
+ {
va_list args;
va_start(args, format);
vwprintw(m_window, format, args);
--- lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h.orig 2018-06-05 08:37:38.497120300 +0300
+++ lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h 2018-06-05 08:37:29.540677200 +0300
@@ -200,10 +200,19 @@
lldb::UnwindPlanSP GetFullUnwindPlanForFrame();
- void UnwindLogMsg(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
+ void UnwindLogMsg(const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
+ __attribute__((format(printf, 2, 3)));
+#endif
void UnwindLogMsgVerbose(const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
__attribute__((format(printf, 2, 3)));
+#endif
bool IsUnwindPlanValidForCurrentPC(lldb::UnwindPlanSP unwind_plan_sp,
int &valid_pc_offset);
--- lldb/tools/debugserver/source/DNBLog.h.orig 2018-06-05 08:26:34.638115000 +0300
+++ lldb/tools/debugserver/source/DNBLog.h 2018-06-05 08:49:23.733176300 +0300
@@ -36,21 +36,65 @@
#if defined(DNBLOG_ENABLED)
void _DNBLog(uint32_t flags, const char *format, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
__attribute__((format(printf, 2, 3)));
-void _DNBLogDebug(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
+#endif
+void _DNBLogDebug(const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 1, 2)));
+#else
+ __attribute__((format(printf, 1, 2)));
+#endif
void _DNBLogDebugVerbose(const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 1, 2)));
+#else
__attribute__((format(printf, 1, 2)));
+#endif
void _DNBLogThreaded(const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 1, 2)));
+#else
__attribute__((format(printf, 1, 2)));
+#endif
void _DNBLogThreadedIf(uint32_t mask, const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
__attribute__((format(printf, 2, 3)));
-void _DNBLogError(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
+#endif
+void _DNBLogError(const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 1, 2)));
+#else
+ __attribute__((format(printf, 1, 2)));
+#endif
void _DNBLogFatalError(int err, const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 2, 3)));
+#else
__attribute__((format(printf, 2, 3)));
-void _DNBLogVerbose(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
-void _DNBLogWarning(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
+#endif
+void _DNBLogVerbose(const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 1, 2)));
+#else
+ __attribute__((format(printf, 1, 2)));
+#endif
+void _DNBLogWarning(const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 1, 2)));
+#else
+ __attribute__((format(printf, 1, 2)));
+#endif
void _DNBLogWarningVerbose(const char *fmt, ...)
+#if defined(__MINGW32__) && defined(__USE_MINGW_ANSI_STDIO)
+ __attribute__((format(gnu_printf, 1, 2)));
+#else
__attribute__((format(printf, 1, 2)));
+#endif
bool DNBLogCheckLogBit(uint32_t bit);
uint32_t DNBLogSetLogMask(uint32_t mask);
uint32_t DNBLogGetLogMask();