Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2006:
[Freeciv-Dev] (PR#12932) windows printf doesn't allow reordering argumen
Home

[Freeciv-Dev] (PR#12932) windows printf doesn't allow reordering argumen

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: aaron_talamasca@xxxxxxxx, abudhabi2@xxxxxx, atagi@xxxxxxxxxxxxxx, chrisk@xxxxxxxxx, cyril.delalande@xxxxxxxxx, ka_xperience@xxxxxxxx, lvl@xxxxxxxxxxxxxxxx, s_keishi@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#12932) windows printf doesn't allow reordering arguments
From: "Christian Prochaska" <cp.ml.freeciv.dev@xxxxxxxxxxxxxx>
Date: Wed, 1 Mar 2006 19:05:03 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12932 >

> [jdorje - Mi 01. Mär 2006, 20:01:30]:
> 
> It works by adding the include to support.c because that's the file that
> defines my_snprintf and cat_snprintf, which are probably the big
> offenders.  But this won't necessarily catch all offenders for all
> languages.  With the include added only to support.c, I don't understand
> why the changes to the other header files are needed...since these
> aren't affected outside the compilation of support.o.
> 

It has to do with the order in which the headers are included in
support.c (or other .c files that could include libutf8.h). With the
usual order:

#ifdef HAVE_LIBUTF8_H
#include <libutf8.h>
#endif

#include "fcintl.h"
#include "mem.h"
#include "netintf.h"

#include "support.h"

you'll get a compiler warning in support.h ("`utf8_printf' is an
unrecognized format function type"). To avoid the warnings without
changing the header files, libutf8.h would have to be included last
(like in the 3c patch), but that wouldn't look very clean IMHO.

> Another possibility might be adding the include to support.h or
> shared.h.  These are included in most .c files.  support.h for instance
> includes stdbool.h which is needed for the very commonly-used 'bool' type.
> 

Sounds good and works as well. Patches for 2.0 and 2.1 are attached.

Index: ai/ailog.h
===================================================================
--- ai/ailog.h  (revision 11679)
+++ ai/ailog.h  (working copy)
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/**********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -73,14 +73,14 @@
 
 void TECH_LOG(int level, const struct player *pplayer, Tech_type_id id,
               const char *msg, ...)
-     fc__attribute((format (printf, 4, 5)));
+     fc__attribute((__format__ (__printf__, 4, 5)));
 void DIPLO_LOG(int level, const struct player *pplayer,
               const struct player *aplayer, const char *msg, ...)
-     fc__attribute((format (printf, 4, 5)));
+     fc__attribute((__format__ (__printf__, 4, 5)));
 void CITY_LOG(int level, const struct city *pcity, const char *msg, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 void UNIT_LOG(int level, const struct unit *punit, const char *msg, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 void BODYGUARD_LOG(int level, const struct unit *punit, const char *msg);
 void TIMING_LOG(enum ai_timer timer, enum ai_timer_activity activity);
 void TIMING_RESULTS(void);
Index: client/climisc.h
===================================================================
--- client/climisc.h    (revision 11679)
+++ client/climisc.h    (working copy)
@@ -100,7 +100,7 @@
                  enum event_type event, int conn_id);
 void create_event(struct tile *ptile, enum event_type event,
                  const char *format, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 void write_chatline_content(const char *txt);
 
 void reports_freeze(void);
Index: client/gui-ftwl/gui_text.c
===================================================================
--- client/gui-ftwl/gui_text.c  (revision 11679)
+++ client/gui-ftwl/gui_text.c  (working copy)
@@ -50,10 +50,10 @@
 
 static void real_add_line(char **buffer, size_t * buffer_size,
                          const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 static void real_add(char **buffer, size_t * buffer_size,
                     const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 
 #define add_line(...) real_add_line(&out,&out_size, __VA_ARGS__)
 #define add(...) real_add(&out,&out_size, __VA_ARGS__)
Index: common/worklist.h
===================================================================
--- common/worklist.h   (revision 11679)
+++ common/worklist.h   (working copy)
@@ -51,10 +51,10 @@
  * the same for saving and loading). */
 void worklist_load(struct section_file *file, struct worklist *pwl,
                   const char *path, ...)
-  fc__attribute((format (printf, 3, 4)));
+  fc__attribute((__format__ (__printf__, 3, 4)));
 void worklist_save(struct section_file *file, struct worklist *pwl,
                   const char *path, ...)
-  fc__attribute((format (printf, 3, 4)));
+  fc__attribute((__format__ (__printf__, 3, 4)));
 
 /* Iterate over all entries in the worklist. */
 #define worklist_iterate(worklist, prod)                                   \
Index: configure.ac
===================================================================
--- configure.ac        (revision 11679)
+++ configure.ac        (working copy)
@@ -345,6 +345,18 @@
   AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Locale directory])
 fi  
 
+dnl Check libUTF8
+AC_ARG_WITH(libutf8,
+            AC_HELP_STRING([--with-libutf8],
+               [Use the libutf8 library (needed for some systems)]),
+            [with_libutf8=$withval], [with_libutf8=no])
+if test "$MINGW32" = yes || test "$with_libutf8" = yes; then
+  AC_CHECK_HEADER(libutf8.h, [],
+                  AC_MSG_ERROR([Could not find libutf8 library (libutf8.h)]))
+  AC_DEFINE(HAVE_LIBUTF8_H, 1, [Use libutf8's stdio functions])
+  LIBS="$LIBS -lutf8"
+fi
+
 dnl Check for zlib (needed for libpng)
 AC_CHECK_LIB(z, gzgets, , 
   AC_MSG_ERROR([Could not find zlib library.]), )
Index: server/console.h
===================================================================
--- server/console.h    (revision 11679)
+++ server/console.h    (working copy)
@@ -55,7 +55,7 @@
 
 /* write to console and add line-break, and show prompt if required. */
 void con_write(enum rfc_status rfc_status, const char *message, ...)
-     fc__attribute((format (printf, 2, 3)));
+     fc__attribute((__format__ (__printf__, 2, 3)));
 
 /* write to console and add line-break, and show prompt if required.
    ie, same as con_write, but without the format string stuff. */
Index: server/plrhand.h
===================================================================
--- server/plrhand.h    (revision 11679)
+++ server/plrhand.h    (working copy)
@@ -50,23 +50,23 @@
 
 void notify_conn(struct conn_list *dest, struct tile *ptile,
                 enum event_type event, const char *format, ...)
-                 fc__attribute((format (printf, 4, 5)));
+                 fc__attribute((__format__ (__printf__, 4, 5)));
 void vnotify_conn(struct conn_list *dest, struct tile *ptile,
                  enum event_type event, const char *format,
                  va_list vargs);
 void notify_player(const struct player *pplayer, struct tile *ptile,
                   enum event_type event, const char *format, ...)
-                   fc__attribute((format (printf, 4, 5)));
+                   fc__attribute((__format__ (__printf__, 4, 5)));
 void notify_embassies(struct player *pplayer, struct player *exclude,
                      struct tile *ptile, enum event_type event,
                      const char *format, ...)
-                     fc__attribute((format (printf, 5, 6)));
+                     fc__attribute((__format__ (__printf__, 5, 6)));
 void notify_team(struct player* pplayer, struct tile *ptile,
                  enum event_type event, const char *format, ...)
-                 fc__attribute((format (printf, 4, 5)));
+                 fc__attribute((__format__ (__printf__, 4, 5)));
 void notify_research(struct player *pplayer,
                     enum event_type event, const char *format, ...)
-                     fc__attribute((format (printf, 3, 4)));
+                     fc__attribute((__format__ (__printf__, 3, 4)));
 
 struct conn_list *player_reply_dest(struct player *pplayer);
 
Index: server/stdinhand.c
===================================================================
--- server/stdinhand.c  (revision 11679)
+++ server/stdinhand.c  (working copy)
@@ -417,7 +417,7 @@
 static void cmd_reply_prefix(enum command_id cmd, struct connection *caller,
                             enum rfc_status rfc_status, const char *prefix,
                             const char *format, ...)
-     fc__attribute((format (printf, 5, 6)));
+     fc__attribute((__format__ (__printf__, 5, 6)));
 static void cmd_reply_prefix(enum command_id cmd, struct connection *caller,
                             enum rfc_status rfc_status, const char *prefix,
                             const char *format, ...)
@@ -433,7 +433,7 @@
 **************************************************************************/
 static void cmd_reply(enum command_id cmd, struct connection *caller,
                      enum rfc_status rfc_status, const char *format, ...)
-     fc__attribute((format (printf, 4, 5)));
+     fc__attribute((__format__ (__printf__, 4, 5)));
 static void cmd_reply(enum command_id cmd, struct connection *caller,
                      enum rfc_status rfc_status, const char *format, ...)
 {
Index: utility/astring.h
===================================================================
--- utility/astring.h   (revision 11679)
+++ utility/astring.h   (working copy)
@@ -40,8 +40,8 @@
 void astr_free(struct astring *astr);
 void astr_clear(struct astring *astr);
 void astr_add(struct astring *astr, const char *format, ...)
-      fc__attribute((format(printf, 2, 3)));
+      fc__attribute((__format__(__printf__, 2, 3)));
 void astr_add_line(struct astring *astr, const char *format, ...)
-      fc__attribute((format(printf, 2, 3)));
+      fc__attribute((__format__(__printf__, 2, 3)));
 
 #endif  /* FC__ASTRING_H */
Index: utility/fciconv.h
===================================================================
--- utility/fciconv.h   (revision 11679)
+++ utility/fciconv.h   (working copy)
@@ -36,7 +36,7 @@
 
 #define fc_printf(...) fc_fprintf(stdout, __VA_ARGS__)
 void fc_fprintf(FILE *stream, const char *format, ...)
-      fc__attribute((format (printf, 2, 3)));
+      fc__attribute((__format__ (__printf__, 2, 3)));
 
 char *convert_string(const char *text,
                     const char *from,
Index: utility/ioz.h
===================================================================
--- utility/ioz.h       (revision 11679)
+++ utility/ioz.h       (working copy)
@@ -36,7 +36,7 @@
 int fz_fclose(fz_FILE *fp);
 char *fz_fgets(char *buffer, int size, fz_FILE *fp);
 int fz_fprintf(fz_FILE *fp, const char *format, ...)
-     fc__attribute((format (printf, 2, 3)));
+     fc__attribute((__format__ (__printf__, 2, 3)));
 
 int fz_ferror(fz_FILE *fp);     
 const char *fz_strerror(fz_FILE *fp);
Index: utility/log.h
===================================================================
--- utility/log.h       (revision 11679)
+++ utility/log.h       (working copy)
@@ -58,7 +58,7 @@
 void log_set_callback(log_callback_fn callback);
 
 void real_freelog(int level, const char *message, ...)
-                  fc__attribute((format (printf, 2, 3)));
+                  fc__attribute((__format__ (__printf__, 2, 3)));
 void vreal_freelog(int level, const char *message, va_list ap);
 
 
Index: utility/registry.h
===================================================================
--- utility/registry.h  (revision 11679)
+++ utility/registry.h  (working copy)
@@ -47,68 +47,68 @@
 
 void secfile_insert_int(struct section_file *my_section_file, 
                        int val, const char *path, ...)
-                        fc__attribute((format (printf, 3, 4)));
+                        fc__attribute((__format__ (__printf__, 3, 4)));
 void secfile_insert_int_comment(struct section_file *my_section_file,
                                int val, const char *const comment, 
                                const char *path, ...)
-                                fc__attribute((format(printf, 4, 5)));
+                                fc__attribute((__format__(__printf__, 4, 5)));
 void secfile_insert_bool(struct section_file *my_section_file,
                         bool val, const char *path, ...)
-                         fc__attribute((format(printf, 3, 4)));
+                         fc__attribute((__format__(__printf__, 3, 4)));
 
 void secfile_insert_str(struct section_file *my_section_file, 
                        const char *sval, const char *path, ...)
-                        fc__attribute((format (printf, 3, 4)));
+                        fc__attribute((__format__ (__printf__, 3, 4)));
 void secfile_insert_str_comment(struct section_file *my_section_file,
                                char *sval, const char *const comment,
                                const char *path, ...)
-                                fc__attribute((format (printf, 4, 5)));
+                                fc__attribute((__format__ (__printf__, 4, 5)));
 void secfile_insert_str_vec(struct section_file *my_section_file, 
                            const char **values, int dim,
                            const char *path, ...)
-                            fc__attribute((format (printf, 4, 5)));
+                            fc__attribute((__format__ (__printf__, 4, 5)));
 
 bool section_file_lookup(struct section_file *my_section_file, 
                        const char *path, ...)
-                        fc__attribute((format (printf, 2, 3)));
+                        fc__attribute((__format__ (__printf__, 2, 3)));
 
 int secfile_lookup_int(struct section_file *my_section_file, 
                       const char *path, ...)
-                       fc__attribute((format (printf, 2, 3)));
+                       fc__attribute((__format__ (__printf__, 2, 3)));
 
 bool secfile_lookup_bool(struct section_file *my_section_file, 
                        const char *path, ...)
-                        fc__attribute((format (printf, 2, 3)));
+                        fc__attribute((__format__ (__printf__, 2, 3)));
                       
 char *secfile_lookup_str(struct section_file *my_section_file, 
                         const char *path, ...)
-                         fc__attribute((format (printf, 2, 3)));
+                         fc__attribute((__format__ (__printf__, 2, 3)));
 
 char *secfile_lookup_str_int(struct section_file *my_section_file, 
                             int *ival, const char *path, ...)
-                             fc__attribute((format (printf, 3, 4)));
+                             fc__attribute((__format__ (__printf__, 3, 4)));
 
 int secfile_lookup_int_default(struct section_file *my_section_file,
                                int def, const char *path, ...)
-                               fc__attribute((format (printf, 3, 4)));
+                               fc__attribute((__format__ (__printf__, 3, 4)));
 
 bool secfile_lookup_bool_default(struct section_file *my_section_file,
                                 bool def, const char *path, ...)
-                                 fc__attribute((format (printf, 3, 4)));
+                                 fc__attribute((__format__ (__printf__, 3, 
4)));
 
 char *secfile_lookup_str_default(struct section_file *my_section_file, 
                                 const char *def, const char *path, ...)
-                                 fc__attribute((format (printf, 3, 4)));
+                                 fc__attribute((__format__ (__printf__, 3, 
4)));
 
 int secfile_lookup_vec_dimen(struct section_file *my_section_file, 
                             const char *path, ...)
-                             fc__attribute((format (printf, 2, 3)));
+                             fc__attribute((__format__ (__printf__, 2, 3)));
 int *secfile_lookup_int_vec(struct section_file *my_section_file,
                            int *dimen, const char *path, ...)
-                            fc__attribute((format (printf, 3, 4)));
+                            fc__attribute((__format__ (__printf__, 3, 4)));
 char **secfile_lookup_str_vec(struct section_file *my_section_file,
                              int *dimen, const char *path, ...)
-                              fc__attribute((format (printf, 3, 4)));
+                              fc__attribute((__format__ (__printf__, 3, 4)));
 
 char **secfile_get_secnames_prefix(struct section_file *my_section_file,
                                   const char *prefix, int *num);
Index: utility/shared.h
===================================================================
--- utility/shared.h    (revision 11679)
+++ utility/shared.h    (working copy)
@@ -162,11 +162,11 @@
 
 char *end_of_strn(char *str, int *nleft);
 int cat_snprintf(char *str, size_t n, const char *format, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 
 #define die(...) real_die(__FILE__, __LINE__, __VA_ARGS__)
 void real_die(const char *file, int line, const char *format, ...)
-      fc__attribute((format (printf, 3, 4)));
+      fc__attribute((__format__ (__printf__, 3, 4)));
 
 /**************************************************************************
 ...
Index: utility/support.h
===================================================================
--- utility/support.h   (revision 11679)
+++ utility/support.h   (working copy)
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/**********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -26,6 +26,9 @@
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
 
 #ifdef TRUE
 #undef TRUE
@@ -84,7 +87,7 @@
 #define sz_strlcat(dest,src) ((void)mystrlcat((dest),(src),sizeof(dest)))
 
 int my_snprintf(char *str, size_t n, const char *format, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 
 int my_vsnprintf(char *str, size_t n, const char *format, va_list ap );
 
Index: ai/ailog.h
===================================================================
--- ai/ailog.h  (revision 11687)
+++ ai/ailog.h  (working copy)
@@ -32,11 +32,11 @@
 
 void PLAYER_LOG(int level, struct player *pplayer, struct ai_data *ai,
                 const char *msg, ...)
-     fc__attribute((format (printf, 4, 5)));
+     fc__attribute((__format__ (__printf__, 4, 5)));
 void CITY_LOG(int level, struct city *pcity, const char *msg, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 void UNIT_LOG(int level, struct unit *punit, const char *msg, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 void BODYGUARD_LOG(int level, struct unit *punit, const char *msg);
 
 #endif  /* FC__AILOG_H */
Index: client/climisc.h
===================================================================
--- client/climisc.h    (revision 11687)
+++ client/climisc.h    (working copy)
@@ -106,7 +106,7 @@
                  enum event_type event, int conn_id);
 void create_event(struct tile *ptile, enum event_type event,
                  const char *format, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 void write_chatline_content(const char *txt);
 
 void reports_freeze(void);
Index: client/gui-ftwl/gui_text.c
===================================================================
--- client/gui-ftwl/gui_text.c  (revision 11687)
+++ client/gui-ftwl/gui_text.c  (working copy)
@@ -50,10 +50,10 @@
 
 static void real_add_line(char **buffer, size_t * buffer_size,
                          const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 static void real_add(char **buffer, size_t * buffer_size,
                     const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 
 #define add_line(...) real_add_line(&out,&out_size, __VA_ARGS__)
 #define add(...) real_add(&out,&out_size, __VA_ARGS__)
Index: client/text.c
===================================================================
--- client/text.c       (revision 11687)
+++ client/text.c       (working copy)
@@ -46,10 +46,10 @@
 
 static void real_add_line(char **buffer, size_t * buffer_size,
                          const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 static void real_add(char **buffer, size_t * buffer_size,
                     const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 
 #define add_line(...) real_add_line(&out,&out_size, __VA_ARGS__)
 #define add(...) real_add(&out,&out_size, __VA_ARGS__)
Index: configure.ac
===================================================================
--- configure.ac        (revision 11687)
+++ configure.ac        (working copy)
@@ -321,6 +321,18 @@
   LIBS="$LIBS -lwsock32"
 fi
 
+dnl Check libUTF8
+AC_ARG_WITH(libutf8,
+            AC_HELP_STRING([--with-libutf8],
+               [Use the libutf8 library (needed for some systems)]),
+            [with_libutf8=$withval], [with_libutf8=no])
+if test "$MINGW32" = yes || test "$with_libutf8" = yes; then
+  AC_CHECK_HEADER(libutf8.h, [],
+                  AC_MSG_ERROR([Could not find libutf8 library (libutf8.h)]))
+  AC_DEFINE(HAVE_LIBUTF8_H, 1, [Use libutf8's stdio functions])
+  LIBS="$LIBS -lutf8"
+fi
+
 dnl Check for zlib (needed for libpng)
 AC_CHECK_LIB(z, gzgets, , 
   AC_MSG_ERROR([Could not find zlib library.]), )
Index: server/console.h
===================================================================
--- server/console.h    (revision 11687)
+++ server/console.h    (working copy)
@@ -55,7 +55,7 @@
 
 /* write to console and add line-break, and show prompt if required. */
 void con_write(enum rfc_status rfc_status, const char *message, ...)
-     fc__attribute((format (printf, 2, 3)));
+     fc__attribute((__format__ (__printf__, 2, 3)));
 
 /* write to console and add line-break, and show prompt if required.
    ie, same as con_write, but without the format string stuff. */
Index: server/plrhand.h
===================================================================
--- server/plrhand.h    (revision 11687)
+++ server/plrhand.h    (working copy)
@@ -45,20 +45,20 @@
 
 void notify_conn_ex(struct conn_list *dest, struct tile *ptile,
                    enum event_type event, const char *format, ...)
-                    fc__attribute((format (printf, 4, 5)));
+                    fc__attribute((__format__ (__printf__, 4, 5)));
 void vnotify_conn_ex(struct conn_list *dest, struct tile *ptile,
                     enum event_type event, const char *format,
                     va_list vargs);
 void notify_conn(struct conn_list *dest, const char *format, ...) 
-                 fc__attribute((format (printf, 2, 3)));
+                 fc__attribute((__format__ (__printf__, 2, 3)));
 void notify_player_ex(const struct player *pplayer, struct tile *ptile,
                      enum event_type event, const char *format, ...)
-                      fc__attribute((format (printf, 4, 5)));
+                      fc__attribute((__format__ (__printf__, 4, 5)));
 void notify_player(const struct player *pplayer, const char *format, ...)
-                   fc__attribute((format (printf, 2, 3)));
+                   fc__attribute((__format__ (__printf__, 2, 3)));
 void notify_embassies(struct player *pplayer, struct player *exclude,
                      const char *format, ...)
-                     fc__attribute((format (printf, 3, 4)));
+                     fc__attribute((__format__ (__printf__, 3, 4)));
 
 struct conn_list *player_reply_dest(struct player *pplayer);
 
Index: server/stdinhand.c
===================================================================
--- server/stdinhand.c  (revision 11687)
+++ server/stdinhand.c  (working copy)
@@ -420,7 +420,7 @@
 static void cmd_reply_prefix(enum command_id cmd, struct connection *caller,
                             enum rfc_status rfc_status, const char *prefix,
                             const char *format, ...)
-     fc__attribute((format (printf, 5, 6)));
+     fc__attribute((__format__ (__printf__, 5, 6)));
 static void cmd_reply_prefix(enum command_id cmd, struct connection *caller,
                             enum rfc_status rfc_status, const char *prefix,
                             const char *format, ...)
@@ -436,7 +436,7 @@
 **************************************************************************/
 static void cmd_reply(enum command_id cmd, struct connection *caller,
                      enum rfc_status rfc_status, const char *format, ...)
-     fc__attribute((format (printf, 4, 5)));
+     fc__attribute((__format__ (__printf__, 4, 5)));
 static void cmd_reply(enum command_id cmd, struct connection *caller,
                      enum rfc_status rfc_status, const char *format, ...)
 {
Index: utility/astring.h
===================================================================
--- utility/astring.h   (revision 11687)
+++ utility/astring.h   (working copy)
@@ -40,6 +40,6 @@
 void astr_free(struct astring *astr);
 void astr_clear(struct astring *astr);
 void astr_add(struct astring *astr, const char *format, ...)
-      fc__attribute((format(printf, 2, 3)));
+      fc__attribute((__format__(__printf__, 2, 3)));
 
 #endif  /* FC__ASTRING_H */
Index: utility/fciconv.h
===================================================================
--- utility/fciconv.h   (revision 11687)
+++ utility/fciconv.h   (working copy)
@@ -36,7 +36,7 @@
 
 #define fc_printf(...) fc_fprintf(stdout, __VA_ARGS__)
 void fc_fprintf(FILE *stream, const char *format, ...)
-      fc__attribute((format (printf, 2, 3)));
+      fc__attribute((__format__ (__printf__, 2, 3)));
 
 size_t get_internal_string_length(const char *text);
 
Index: utility/ioz.h
===================================================================
--- utility/ioz.h       (revision 11687)
+++ utility/ioz.h       (working copy)
@@ -36,7 +36,7 @@
 int fz_fclose(fz_FILE *fp);
 char *fz_fgets(char *buffer, int size, fz_FILE *fp);
 int fz_fprintf(fz_FILE *fp, const char *format, ...)
-     fc__attribute((format (printf, 2, 3)));
+     fc__attribute((__format__ (__printf__, 2, 3)));
 
 int fz_ferror(fz_FILE *fp);     
 const char *fz_strerror(fz_FILE *fp);
Index: utility/log.h
===================================================================
--- utility/log.h       (revision 11687)
+++ utility/log.h       (working copy)
@@ -58,7 +58,7 @@
 void log_set_callback(log_callback_fn callback);
 
 void real_freelog(int level, const char *message, ...)
-                  fc__attribute((format (printf, 2, 3)));
+                  fc__attribute((__format__ (__printf__, 2, 3)));
 void vreal_freelog(int level, const char *message, va_list ap);
 
 
Index: utility/registry.h
===================================================================
--- utility/registry.h  (revision 11687)
+++ utility/registry.h  (working copy)
@@ -44,68 +44,68 @@
 
 void secfile_insert_int(struct section_file *my_section_file, 
                        int val, const char *path, ...)
-                        fc__attribute((format (printf, 3, 4)));
+                        fc__attribute((__format__ (__printf__, 3, 4)));
 void secfile_insert_int_comment(struct section_file *my_section_file,
                                int val, const char *const comment, 
                                const char *path, ...)
-                                fc__attribute((format(printf, 4, 5)));
+                                fc__attribute((__format__(__printf__, 4, 5)));
 void secfile_insert_bool(struct section_file *my_section_file,
                         bool val, const char *path, ...)
-                         fc__attribute((format(printf, 3, 4)));
+                         fc__attribute((__format__(__printf__, 3, 4)));
 
 void secfile_insert_str(struct section_file *my_section_file, 
                        const char *sval, const char *path, ...)
-                        fc__attribute((format (printf, 3, 4)));
+                        fc__attribute((__format__ (__printf__, 3, 4)));
 void secfile_insert_str_comment(struct section_file *my_section_file,
                                char *sval, const char *const comment,
                                const char *path, ...)
-                                fc__attribute((format (printf, 4, 5)));
+                                fc__attribute((__format__ (__printf__, 4, 5)));
 void secfile_insert_str_vec(struct section_file *my_section_file, 
                            const char **values, int dim,
                            const char *path, ...)
-                            fc__attribute((format (printf, 4, 5)));
+                            fc__attribute((__format__ (__printf__, 4, 5)));
 
 bool section_file_lookup(struct section_file *my_section_file, 
                        const char *path, ...)
-                        fc__attribute((format (printf, 2, 3)));
+                        fc__attribute((__format__ (__printf__, 2, 3)));
 
 int secfile_lookup_int(struct section_file *my_section_file, 
                       const char *path, ...)
-                       fc__attribute((format (printf, 2, 3)));
+                       fc__attribute((__format__ (__printf__, 2, 3)));
 
 bool secfile_lookup_bool(struct section_file *my_section_file, 
                        const char *path, ...)
-                        fc__attribute((format (printf, 2, 3)));
+                        fc__attribute((__format__ (__printf__, 2, 3)));
                       
 char *secfile_lookup_str(struct section_file *my_section_file, 
                         const char *path, ...)
-                         fc__attribute((format (printf, 2, 3)));
+                         fc__attribute((__format__ (__printf__, 2, 3)));
 
 char *secfile_lookup_str_int(struct section_file *my_section_file, 
                             int *ival, const char *path, ...)
-                             fc__attribute((format (printf, 3, 4)));
+                             fc__attribute((__format__ (__printf__, 3, 4)));
 
 int secfile_lookup_int_default(struct section_file *my_section_file,
                                int def, const char *path, ...)
-                               fc__attribute((format (printf, 3, 4)));
+                               fc__attribute((__format__ (__printf__, 3, 4)));
 
 bool secfile_lookup_bool_default(struct section_file *my_section_file,
                                 bool def, const char *path, ...)
-                                 fc__attribute((format (printf, 3, 4)));
+                                 fc__attribute((__format__ (__printf__, 3, 
4)));
 
 char *secfile_lookup_str_default(struct section_file *my_section_file, 
                                 const char *def, const char *path, ...)
-                                 fc__attribute((format (printf, 3, 4)));
+                                 fc__attribute((__format__ (__printf__, 3, 
4)));
 
 int secfile_lookup_vec_dimen(struct section_file *my_section_file, 
                             const char *path, ...)
-                             fc__attribute((format (printf, 2, 3)));
+                             fc__attribute((__format__ (__printf__, 2, 3)));
 int *secfile_lookup_int_vec(struct section_file *my_section_file,
                            int *dimen, const char *path, ...)
-                            fc__attribute((format (printf, 3, 4)));
+                            fc__attribute((__format__ (__printf__, 3, 4)));
 char **secfile_lookup_str_vec(struct section_file *my_section_file,
                              int *dimen, const char *path, ...)
-                              fc__attribute((format (printf, 3, 4)));
+                              fc__attribute((__format__ (__printf__, 3, 4)));
 
 char **secfile_get_secnames_prefix(struct section_file *my_section_file,
                                   const char *prefix, int *num);
Index: utility/shared.h
===================================================================
--- utility/shared.h    (revision 11687)
+++ utility/shared.h    (working copy)
@@ -216,11 +216,11 @@
 
 char *end_of_strn(char *str, int *nleft);
 int cat_snprintf(char *str, size_t n, const char *format, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 
 #define die(...) real_die(__FILE__, __LINE__, __VA_ARGS__)
 void real_die(const char *file, int line, const char *format, ...)
-      fc__attribute((format (printf, 3, 4)));
+      fc__attribute((__format__ (__printf__, 3, 4)));
 
 /**************************************************************************
 ...
Index: utility/support.h
===================================================================
--- utility/support.h   (revision 11687)
+++ utility/support.h   (working copy)
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/**********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -26,6 +26,9 @@
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
 
 #include "shared.h"            /* bool type and fc__attribute */
 
@@ -43,7 +46,7 @@
 #define sz_strlcat(dest,src) ((void)mystrlcat((dest),(src),sizeof(dest)))
 
 int my_snprintf(char *str, size_t n, const char *format, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 
 int my_vsnprintf(char *str, size_t n, const char *format, va_list ap );
 

[Prev in Thread] Current Thread [Next in Thread]