summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2020-06-30 17:14:36 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2020-06-30 17:14:36 -0700
commita3db726f02be8ac285f51106070a04aca7ab0142 (patch)
treebe35b568bba4a7b41008e391e6ab13bc3bd3ecf5 /include
parent367350319b8c5d2a79f400915d7a51be9cb98209 (diff)
parent8877a3ddb08e5cb7cd60704380ccccb5bb5c36b2 (diff)
downloadnasm-a3db726f02be8ac285f51106070a04aca7ab0142.tar.gz
Merge remote-tracking branch 'github/nasm-2.15.xx'
Resolved Conflicts: version Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'include')
-rw-r--r--include/compiler.h25
-rw-r--r--include/strlist.h8
2 files changed, 27 insertions, 6 deletions
diff --git a/include/compiler.h b/include/compiler.h
index 43984338..a1905d27 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -1,5 +1,5 @@
/* ----------------------------------------------------------------------- *
- *
+ *
* Copyright 2007-2018 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
@@ -14,7 +14,7 @@
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
@@ -310,6 +310,27 @@ static inline void *mempcpy(void *dst, const void *src, size_t n)
#define printf_func(fmt, list) format_func3(printf,fmt,list)
#define printf_func_ptr(fmt, list) format_func3_ptr(printf,fmt,list)
+/*
+ * A static [inline] function which either is currently unused but
+ * likely to be used in the future, or used only under some #if
+ * combinations. Mark with this option to suppress compiler
+ * warnings.
+ *
+ * This is better than #if(def) because it still lets the compiler
+ * analyze the function for validity, and it works even for the
+ * conditional use case.
+ *
+ * The macro UNUSED is set to 1 if the unused macro is meaningful,
+ * otherwise 0; this may be useful in some #if statements.
+ */
+#ifdef HAVE_FUNC_ATTRIBUTE_UNUSED
+# define unused __attribute__((unused))
+# define UNUSED 1
+#else
+# define unused
+# define UNUSED 0
+#endif
+
/* Determine probabilistically if something is a compile-time constant */
#ifdef HAVE___BUILTIN_CONSTANT_P
# if defined(__GNUC__) && (__GNUC__ >= 5)
diff --git a/include/strlist.h b/include/strlist.h
index 2c80d0be..f1775abd 100644
--- a/include/strlist.h
+++ b/include/strlist.h
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2018 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2020 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -78,10 +78,10 @@ static inline size_t strlist_size(const struct strlist *list)
}
struct strlist safe_alloc *strlist_alloc(bool uniq);
-const struct strlist_entry * never_null strlist_add(struct strlist *list, const char *str);
-const struct strlist_entry * printf_func(2, 3) never_null
+const struct strlist_entry *strlist_add(struct strlist *list, const char *str);
+const struct strlist_entry * printf_func(2, 3)
strlist_printf(struct strlist *list, const char *fmt, ...);
-const struct strlist_entry * never_null
+const struct strlist_entry *
strlist_vprintf(struct strlist *list, const char *fmt, va_list ap);
const struct strlist_entry *
strlist_find(const struct strlist *list, const char *str);