]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* include/grub/misc.h: Don't use warn_unused_result on gcc < 3.4.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 18 Oct 2013 14:34:18 +0000 (16:34 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 18 Oct 2013 14:34:18 +0000 (16:34 +0200)
* include/grub/emu/misc.h: Likewise.

ChangeLog
include/grub/emu/misc.h
include/grub/misc.h

index dee88b24e8107e0c53ba824f3a864d1282c83220..9adefcfc00b35c578878b5f60fdbbe7b4f606434 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-18  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * include/grub/misc.h: Don't use warn_unused_result on gcc < 3.4.
+       * include/grub/emu/misc.h: Likewise.
+
 2013-10-18  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/term/i386/pc/vga_text.c: Remove extra declaration of
index 21b83e87c08e434474e62f6b808469d9dbf469ab..c4e579b0bafe5066600bd02f9b3d026340239184 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <grub/symbol.h>
 #include <grub/types.h>
+#include <grub/misc.h>
 
 extern int verbosity;
 extern const char *program_name;
@@ -37,14 +38,14 @@ void grub_find_zpool_from_dir (const char *dir,
                               char **poolname, char **poolfs);
 
 char *grub_make_system_path_relative_to_its_root (const char *path)
 __attribute__ ((warn_unused_result));
WARN_UNUSED_RESULT;
 int
 grub_util_device_is_mapped (const char *dev);
 
-void * EXPORT_FUNC(xmalloc) (grub_size_t size) __attribute__ ((warn_unused_result));
-void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) __attribute__ ((warn_unused_result));
-char * EXPORT_FUNC(xstrdup) (const char *str) __attribute__ ((warn_unused_result));
-char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) __attribute__ ((warn_unused_result));
+void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT;
+void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) WARN_UNUSED_RESULT;
+char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT;
+char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) WARN_UNUSED_RESULT;
 
 void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
 void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
index 075a81cf1144c99ecebdee7a7ec548fbc8da15eb..2acd18884030fd024c265f86df9c26dabfa5c15f 100644 (file)
 #  define GNU_PRINTF printf
 #endif
 
+#if GNUC_PREREQ(3,4)
+#  define WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
+#else
+#  define WARN_UNUSED_RESULT
+#endif
 
 #define ALIGN_UP(addr, align) \
        ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1))
@@ -331,10 +336,10 @@ grub_strtol (const char *str, char **end, int base)
     }
 }
 
-char *EXPORT_FUNC(grub_strdup) (const char *s) __attribute__ ((warn_unused_result));
-char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n) __attribute__ ((warn_unused_result));
+char *EXPORT_FUNC(grub_strdup) (const char *s) WARN_UNUSED_RESULT;
+char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n) WARN_UNUSED_RESULT;
 void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n);
-grub_size_t EXPORT_FUNC(grub_strlen) (const char *s) __attribute__ ((warn_unused_result));
+grub_size_t EXPORT_FUNC(grub_strlen) (const char *s) WARN_UNUSED_RESULT;
 int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2)));
 int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2)));
 
@@ -381,8 +386,8 @@ int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt, ...)
 int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt,
                                 va_list args);
 char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
-     __attribute__ ((format (GNU_PRINTF, 1, 2))) __attribute__ ((warn_unused_result));
-char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) __attribute__ ((warn_unused_result));
+     __attribute__ ((format (GNU_PRINTF, 1, 2))) WARN_UNUSED_RESULT;
+char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) WARN_UNUSED_RESULT;
 void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
 void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
 grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,