Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-09-01 19:01:15 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-09-01 19:01:15 +0400
commit35b61a7512dc1b8b1d8bc562aad2a72d254b8a69 (patch)
tree5050db48823af6cf23eee62b5a013e2f208fdded /source/blender/blenlib/BLI_string.h
parent901dea87a1266479d3b7aab6cfd2d5fbf6adc393 (diff)
Move GCC attributes into a centraized defines
Instead of having ifdef __GNUC__ all over the headers to use special compiler's hints use a special file where all things like this are concentrated. Makes code easier to follow and allows to manage special attributes in more efficient way. Thanks Campbell for review!
Diffstat (limited to 'source/blender/blenlib/BLI_string.h')
-rw-r--r--source/blender/blenlib/BLI_string.h157
1 files changed, 24 insertions, 133 deletions
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 6c66d2f4e18..b995f2565e1 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -38,152 +38,43 @@
extern "C" {
#endif
-char *BLI_strdupn(const char *str, const size_t len)
-#ifdef __GNUC__
-__attribute__((malloc))
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+#include "BLI_compiler_attrs.h"
-char *BLI_strdup(const char *str)
-#ifdef __GNUC__
-__attribute__((malloc))
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+char *BLI_strdupn(const char *str, const size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
-char *BLI_strdupcat(const char *__restrict str1, const char *__restrict str2)
-#ifdef __GNUC__
-__attribute__((malloc))
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+char *BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC;
-char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
+char *BLI_strdupcat(const char *__restrict str1, const char *__restrict str2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC;
-size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL();
-size_t BLI_strcpy_rlen(char *__restrict dst, const char *__restrict src)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
-char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict prefix)
-#ifdef __GNUC__
-__attribute__((malloc))
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+size_t BLI_strcpy_rlen(char *__restrict dst, const char *__restrict src) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
-char *BLI_replacestrN(const char *__restrict str, const char *__restrict substr_old, const char *__restrict substr_new)
-#ifdef __GNUC__
-__attribute__((malloc))
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict prefix) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC;
-size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, ...)
-#ifdef __GNUC__
-__attribute__ ((format(printf, 3, 4)))
-__attribute__((nonnull))
-#endif
-;
+char *BLI_replacestrN(const char *__restrict str, const char *__restrict substr_old, const char *__restrict substr_new) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC;
-size_t BLI_vsnprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, va_list arg)
-#ifdef __GNUC__
-__attribute__ ((format(printf, 3, 0)))
-#endif
-;
-
-char *BLI_sprintfN(const char *__restrict format, ...)
-#ifdef __GNUC__
-__attribute__((malloc))
-__attribute__ ((format(printf, 1, 2)))
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, ...) ATTR_NONNULL() ATTR_PRINTF_FORMAT(3, 4);
-size_t BLI_strescape(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
+size_t BLI_vsnprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, va_list arg) ATTR_PRINTF_FORMAT(3, 0);
-int BLI_strcaseeq(const char *a, const char *b)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
+char *BLI_sprintfN(const char *__restrict format, ...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC ATTR_PRINTF_FORMAT(1, 2);
-char *BLI_strcasestr(const char *s, const char *find)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
-int BLI_strcasecmp(const char *s1, const char *s2)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
-int BLI_strncasecmp(const char *s1, const char *s2, size_t len)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
-int BLI_natstrcmp(const char *s1, const char *s2)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
-size_t BLI_strnlen(const char *str, const size_t maxlen)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-__attribute__((nonnull))
-#endif
-;
-void BLI_timestr(double _time, char *str, size_t maxlen)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
+size_t BLI_strescape(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL();
-void BLI_ascii_strtolower(char *str, const size_t len)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
-void BLI_ascii_strtoupper(char *str, const size_t len)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
-int BLI_str_rstrip_float_zero(char *str, const char pad)
-#ifdef __GNUC__
-__attribute__((nonnull))
-#endif
-;
+int BLI_strcaseeq(const char *a, const char *b) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+char *BLI_strcasestr(const char *s, const char *find) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+int BLI_strcasecmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+int BLI_strncasecmp(const char *s1, const char *s2, size_t len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+int BLI_natstrcmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+size_t BLI_strnlen(const char *str, const size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+void BLI_timestr(double _time, char *str, size_t maxlen) ATTR_NONNULL();
+
+void BLI_ascii_strtolower(char *str, const size_t len) ATTR_NONNULL();
+void BLI_ascii_strtoupper(char *str, const size_t len) ATTR_NONNULL();
+int BLI_str_rstrip_float_zero(char *str, const char pad) ATTR_NONNULL();
#ifdef __cplusplus
}