Skip to content

Commit e80757c

Browse files
committed
patch 8.0.1681: the format attribute fails with MinGW
Problem: The format attribute fails with MinGW. (John Marriott) Solution: Don't use the format attribute with MinGW.
1 parent 756ef11 commit e80757c

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

src/channel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ ch_log(channel_T *ch, const char *fmt, ...)
179179

180180
static void
181181
ch_error(channel_T *ch, const char *fmt, ...)
182-
#ifdef __GNUC__
183-
__attribute__((format(printf, 2, 3)))
182+
#ifdef USE_PRINTF_FORMAT_ATTRIBUTE
183+
__attribute__((format(printf, 2, 3)))
184184
#endif
185185
;
186186

src/proto.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ int
120120
_RTLENTRYF
121121
# endif
122122
vim_snprintf_add(char *, size_t, char *, ...)
123-
#ifdef __GNUC__
123+
#ifdef USE_PRINTF_FORMAT_ATTRIBUTE
124124
__attribute__((format(printf, 3, 4)))
125125
#endif
126126
;
@@ -130,7 +130,7 @@ int
130130
_RTLENTRYF
131131
# endif
132132
vim_snprintf(char *, size_t, char *, ...)
133-
#ifdef __GNUC__
133+
#ifdef USE_PRINTF_FORMAT_ATTRIBUTE
134134
__attribute__((format(printf, 3, 4)))
135135
#endif
136136
;
@@ -223,7 +223,7 @@ void qsort(void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void
223223

224224
/* Not generated automatically, to add extra attribute. */
225225
void ch_log(channel_T *ch, const char *fmt, ...)
226-
#ifdef __GNUC__
226+
#ifdef USE_PRINTF_FORMAT_ATTRIBUTE
227227
__attribute__((format(printf, 2, 3)))
228228
#endif
229229
;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,8 @@ static char *(features[]) =
762762

763763
static int included_patches[] =
764764
{ /* Add new patch number below this line */
765+
/**/
766+
1681,
765767
/**/
766768
1680,
767769
/**/

src/vim.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,6 +2085,10 @@ typedef struct _stat64 stat_T;
20852085
typedef struct stat stat_T;
20862086
#endif
20872087

2088+
#if defined(__GNUC__) && !defined(__MINGW32__)
2089+
# define USE_PRINTF_FORMAT_ATTRIBUTE
2090+
#endif
2091+
20882092
typedef enum
20892093
{
20902094
ASSERT_EQUAL,

0 commit comments

Comments
 (0)