Package: mupen64plus-video-glide64 / 2.5.9-1

Add-printf-format-attribute.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
From: Sven Eckelmann <sven@narfation.org>
Date: Thu, 9 Sep 2010 12:56:04 +0200
Subject: Add printf-format attribute

The compiler needs to get more information for function declaration to
help to find printf specific format attacks.

Forwarded: not-needed
---
 src/Debugger.h     | 2 +-
 src/Gfx1.3.h       | 2 ++
 src/m64p.h         | 2 +-
 src/wrapper/main.h | 5 ++---
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/Debugger.h b/src/Debugger.h
index 15539be..875c6de 100644
--- a/src/Debugger.h
+++ b/src/Debugger.h
@@ -133,5 +133,5 @@ void debug_capture ();
 void debug_cacheviewer ();
 void debug_mouse ();
 void debug_keys ();
-void output (float x, float y, BOOL scale, const char *fmt, ...);
+void output (float x, float y, BOOL scale, const char *fmt, ...) __attribute__ ((format (printf, 4, 5)));
 
diff --git a/src/Gfx1.3.h b/src/Gfx1.3.h
index f8d629f..fee9915 100644
--- a/src/Gfx1.3.h
+++ b/src/Gfx1.3.h
@@ -273,6 +273,7 @@ extern std::ofstream rdp_err;
 
 
 #ifdef RDP_LOGGING
+__inline void FRDP (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
 __inline void FRDP (const char *fmt, ...)
 {
 #ifdef RDP_LOGGING
@@ -289,6 +290,7 @@ __inline void FRDP (const char *fmt, ...)
     va_end(ap);
 #endif
 }
+__inline void FRDP_E (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
 __inline void FRDP_E (const char *fmt, ...)
 {
 #ifdef RDP_ERROR_LOG
diff --git a/src/m64p.h b/src/m64p.h
index 1185bd9..693ae2d 100644
--- a/src/m64p.h
+++ b/src/m64p.h
@@ -37,7 +37,7 @@
 #define VIDEXT_API_VERSION       0x030000
 
 #define VERSION_PRINTF_SPLIT(x) (((x) >> 16) & 0xffff), (((x) >> 8) & 0xff), ((x) & 0xff)
-void WriteLog(m64p_msg_level level, const char *msg, ...);
+void WriteLog(m64p_msg_level level, const char *msg, ...) __attribute__ ((format (printf, 2, 3)));
 
 //The Glide API originally used an integer to pick an enumerated resolution.
 //To accomodate arbitrary resolutions, pack it into a 32-bit struct
diff --git a/src/wrapper/main.h b/src/wrapper/main.h
index 2b30b49..0fd90f8 100644
--- a/src/wrapper/main.h
+++ b/src/wrapper/main.h
@@ -92,8 +92,7 @@ extern int buffer_cleared; // mark that the buffer has been cleared, used to che
 
 #include "glide.h"
 
-void display_warning(const unsigned char *text, ...);
-void display_warning(const char *text, ...);
+void display_warning(const char *text, ...) __attribute__ ((format (printf, 1, 2)));
 void init_geometry();
 void init_textures();
 void init_combiner();
@@ -283,7 +282,7 @@ grConstantColorValueExt(GrChipID_t    tmu,
 #ifdef LOGGING
 void OPEN_LOG();
 void CLOSE_LOG();
-void LOG(char *text, ...);
+void LOG(char *text, ...) __attribute__ ((format (printf, 1, 2)));
 #else // LOGGING
 #define OPEN_LOG()
 #define CLOSE_LOG()