summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorArjan van de Ven <arjanv@redhat.com>2004-07-01 20:31:12 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-07-01 20:31:12 -0700
commit84db66033e6ea4d3294145266ab4a17d3054ddf1 (patch)
tree2a71a6a07e057ba1ab9c384e613beef3239aa5af /include/linux
parent19995e255b140993ca3c017b1d325dc769933fd6 (diff)
[PATCH] produce a warning on unchecked inode_setattr use
The patch below uses the new-in-gcc-3.4 option to generate a warning on unchecked results of marked functions, and applies this to the inode_setattr function (which based on recent bk commits HAS to be checked for it's return value for correct operation). A warning looks like this: fs/ext2/inode.c:1279: warning: ignoring return value of 'inode_setattr', declared with attribute warn_unused_result Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/compiler-gcc+.h1
-rw-r--r--include/linux/compiler-gcc3.h3
-rw-r--r--include/linux/compiler.h4
-rw-r--r--include/linux/fs.h2
4 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/compiler-gcc+.h b/include/linux/compiler-gcc+.h
index 94e6778873a7..5629cf5cd9c9 100644
--- a/include/linux/compiler-gcc+.h
+++ b/include/linux/compiler-gcc+.h
@@ -13,3 +13,4 @@
#define __attribute_used__ __attribute__((__used__))
#define __attribute_pure__ __attribute__((pure))
#define __attribute_const__ __attribute__((__const__))
+#define __must_check __attribute__((warn_unused_result))
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index 265dad4c3cb4..7965ae53d986 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -25,3 +25,6 @@
#if __GNUC_MINOR__ >= 1
#define noinline __attribute__((noinline))
#endif
+#if __GNUC_MINOR__ >= 4
+#define __must_check __attribute__((warn_unused_result))
+#endif
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 151ab34a5b5f..22d83706f4b2 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -69,6 +69,10 @@ extern void __chk_user_ptr(void __user *);
# define __deprecated /* unimplemented */
#endif
+#ifndef __must_check
+#define __must_check
+#endif
+
/*
* Allow us to avoid 'defined but not used' warnings on functions and data,
* as well as force them to be emitted to the assembly file.
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f20e583bb41e..16ed87c94ce5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1521,7 +1521,7 @@ extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count);
extern void simple_release_fs(struct vfsmount **mount, int *count);
extern int inode_change_ok(struct inode *, struct iattr *);
-extern int inode_setattr(struct inode *, struct iattr *);
+extern int __must_check inode_setattr(struct inode *, struct iattr *);
extern void inode_update_time(struct inode *inode, int ctime_too);