]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
Add some function attributes and use them
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Wed, 23 Nov 2011 14:21:29 +0000 (12:21 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Wed, 23 Nov 2011 18:08:04 +0000 (16:08 -0200)
libkmod/libkmod-list.c
libkmod/libkmod-private.h
libkmod/libkmod-util.h

index b7673c4333595e91bdc854fa4a4a596cdec02e47..0c2b0d6b5a5e1bd551678758719a74967b36a054 100644 (file)
@@ -22,7 +22,6 @@
 
 #include "libkmod.h"
 #include "libkmod-private.h"
-#include "libkmod-util.h"
 
 static inline struct list_node *list_node_init(struct list_node *node)
 {
index 8208d94cf8ad6a00460f7add49b02a44af249acb..bcb329042e31adff09d1a759c83b283569396326 100644 (file)
@@ -4,9 +4,10 @@
 #include <stdbool.h>
 #include <syslog.h>
 
+#include "libkmod-util.h"
 #include "libkmod.h"
 
-static inline void __attribute__((always_inline, format(printf, 2, 3)))
+static __always_inline __printf_format(2, 3) void
        kmod_log_null(struct kmod_ctx *ctx, const char *format, ...) {}
 
 #define kmod_log_cond(ctx, prio, arg...) \
@@ -44,10 +45,10 @@ struct kmod_list {
        void *data;
 };
 
-struct kmod_list *kmod_list_append(struct kmod_list *list, void *data);
-struct kmod_list *kmod_list_prepend(struct kmod_list *list, void *data);
+struct kmod_list *kmod_list_append(struct kmod_list *list, void *data) __must_check;
+struct kmod_list *kmod_list_prepend(struct kmod_list *list, void *data) __must_check;
 struct kmod_list *kmod_list_remove(struct kmod_list *list);
 struct kmod_list *kmod_list_remove_data(struct kmod_list *list,
-                                                       const void *data);
+                                       const void *data) __must_check;
 
 #endif
index 81ccc997ce0a7852052afac7d6ebad9225d56dd4..19014d1d343e3727bd4d98cb5ee3e5ef5761445e 100644 (file)
@@ -1,3 +1,23 @@
+/*
+ * libkmod - interface to kernel module operations
+ *
+ * Copyright (C) 2011  ProFUSION embedded systems
+ * Copyright (C) 2011  Lucas De Marchi <lucas.de.marchi@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation version 2.1.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
 #ifndef _LIBKMOD_UTIL_H_
 #define _LIBKMOD_UTIL_H_
 
         ((char *)(member_ptr) - offsetof(containing_type, member))     \
         - check_types_match(*(member_ptr), ((containing_type *)0)->member))
 
+#define __must_check __attribute__((warn_unused_result))
+#define __printf_format(a,b) __attribute__((format (printf, a, b)))
+#if !defined(__always_inline)
+#define __always_inline __inline__ __attribute__((always_inline))
+#endif
+
 #endif