[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new module 'unused-parameter'
From: |
Bruno Haible |
Subject: |
Re: new module 'unused-parameter' |
Date: |
Fri, 25 Dec 2009 11:45:33 +0100 |
User-agent: |
KMail/1.9.9 |
Hi Jim,
Eric wrote:
> Also, se-context.in.h and se-selinux.in.h would benefit from an
> unused-parameter module.
Here's a proposed patch to make the generated selinux/selinux.h and
selinux/context.h files independent of the stuff defined in config.h.
2009-12-25 Bruno Haible <address@hidden>
* lib/se-context.in.h: Arrange to include _GL_UNUSED_PARAMETER
definition. Use _GL_UNUSED_PARAMETER instead of _GL_UNUSED.
* lib/se-selinux.in.h: Likewise.
* modules/selinux-h (Depends-on): Add unused-parameter.
(Makefile.am): Insert definition of _GL_UNUSED_PARAMETER into
selinux/selinux.h and selinux/context.h.
Suggested by Eric Blake.
--- lib/se-context.in.h.orig Fri Dec 25 11:44:09 2009
+++ lib/se-context.in.h Fri Dec 25 11:34:18 2009
@@ -3,24 +3,26 @@
# include <errno.h>
+/* The definition of _GL_UNUSED_PARAMETER is copied here. */
+
typedef int context_t;
-static inline context_t context_new (char const *s _GL_UNUSED)
+static inline context_t context_new (char const *s _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return 0; }
-static inline char *context_str (context_t con _GL_UNUSED)
+static inline char *context_str (context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return (void *) 0; }
-static inline void context_free (context_t c _GL_UNUSED) {}
+static inline void context_free (context_t c _GL_UNUSED_PARAMETER) {}
-static inline int context_user_set (context_t sc _GL_UNUSED,
- char const *s _GL_UNUSED)
+static inline int context_user_set (context_t sc _GL_UNUSED_PARAMETER,
+ char const *s _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int context_role_set (context_t sc _GL_UNUSED,
- char const *s _GL_UNUSED)
+static inline int context_role_set (context_t sc _GL_UNUSED_PARAMETER,
+ char const *s _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int context_range_set (context_t sc _GL_UNUSED,
- char const *s _GL_UNUSED)
+static inline int context_range_set (context_t sc _GL_UNUSED_PARAMETER,
+ char const *s _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int context_type_set (context_t sc _GL_UNUSED,
- char const *s _GL_UNUSED)
+static inline int context_type_set (context_t sc _GL_UNUSED_PARAMETER,
+ char const *s _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
#endif
--- lib/se-selinux.in.h.orig Fri Dec 25 11:44:09 2009
+++ lib/se-selinux.in.h Fri Dec 25 11:34:32 2009
@@ -14,59 +14,61 @@
# include <sys/types.h>
# include <errno.h>
+/* The definition of _GL_UNUSED_PARAMETER is copied here. */
+
typedef unsigned short security_class_t;
# define security_context_t char*
# define is_selinux_enabled() 0
-static inline int getcon (security_context_t *con _GL_UNUSED)
+static inline int getcon (security_context_t *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline void freecon (security_context_t con _GL_UNUSED) {}
+static inline void freecon (security_context_t con _GL_UNUSED_PARAMETER) {}
-static inline int getfscreatecon (security_context_t *con _GL_UNUSED)
+static inline int getfscreatecon (security_context_t *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int setfscreatecon (security_context_t con _GL_UNUSED)
+static inline int setfscreatecon (security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int matchpathcon (char const *file _GL_UNUSED,
- mode_t m _GL_UNUSED,
- security_context_t *con _GL_UNUSED)
+static inline int matchpathcon (char const *file _GL_UNUSED_PARAMETER,
+ mode_t m _GL_UNUSED_PARAMETER,
+ security_context_t *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int getfilecon (char const *file _GL_UNUSED,
- security_context_t *con _GL_UNUSED)
+static inline int getfilecon (char const *file _GL_UNUSED_PARAMETER,
+ security_context_t *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int lgetfilecon (char const *file _GL_UNUSED,
- security_context_t *con _GL_UNUSED)
+static inline int lgetfilecon (char const *file _GL_UNUSED_PARAMETER,
+ security_context_t *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
static inline int fgetfilecon (int fd,
- security_context_t *con _GL_UNUSED)
+ security_context_t *con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int setfilecon (char const *file _GL_UNUSED,
- security_context_t con _GL_UNUSED)
+static inline int setfilecon (char const *file _GL_UNUSED_PARAMETER,
+ security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int lsetfilecon (char const *file _GL_UNUSED,
- security_context_t con _GL_UNUSED)
+static inline int lsetfilecon (char const *file _GL_UNUSED_PARAMETER,
+ security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int fsetfilecon (int fd _GL_UNUSED,
- security_context_t con _GL_UNUSED)
+static inline int fsetfilecon (int fd _GL_UNUSED_PARAMETER,
+ security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
static inline int security_check_context
- (security_context_t con _GL_UNUSED)
+ (security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
static inline int security_check_context_raw
- (security_context_t con _GL_UNUSED)
+ (security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
-static inline int setexeccon (security_context_t con _GL_UNUSED)
+static inline int setexeccon (security_context_t con _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
static inline int security_compute_create
- (security_context_t scon _GL_UNUSED,
- security_context_t tcon _GL_UNUSED,
- security_class_t tclass _GL_UNUSED,
- security_context_t *newcon _GL_UNUSED)
+ (security_context_t scon _GL_UNUSED_PARAMETER,
+ security_context_t tcon _GL_UNUSED_PARAMETER,
+ security_class_t tclass _GL_UNUSED_PARAMETER,
+ security_context_t *newcon _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
static inline int matchpathcon_init_prefix
- (char const *path _GL_UNUSED,
- char const *prefix _GL_UNUSED)
+ (char const *path _GL_UNUSED_PARAMETER,
+ char const *prefix _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
# endif
--- modules/selinux-h.orig Fri Dec 25 11:44:09 2009
+++ modules/selinux-h Fri Dec 25 11:44:07 2009
@@ -10,6 +10,7 @@
Depends-on:
errno
+unused-parameter
configure.ac:
gl_HEADERS_SELINUX_SELINUX_H
@@ -27,6 +28,7 @@
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''NEXT_SELINUX_SELINUX_H''@|$(NEXT_SELINUX_SELINUX_H)|g' \
+ -e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \
< $(srcdir)/se-selinux.in.h; \
} > address@hidden && \
chmod a-x address@hidden && \
@@ -37,7 +39,10 @@
selinux/context.h: se-context.in.h
$(AM_V_at)$(MKDIR_P) selinux
$(AM_V_GEN)rm -f address@hidden $@ && \
- cp $(srcdir)/se-context.in.h address@hidden && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+ sed -e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \
+ < $(srcdir)/se-context.in.h; \
+ } > address@hidden && \
chmod a-x address@hidden && \
mv address@hidden $@
MOSTLYCLEANFILES += selinux/context.h selinux/context.h-t
- Re: stdlib tweak, (continued)
- Re: stdlib tweak, Jim Meyering, 2009/12/22
- Re: stdlib tweak, Eric Blake, 2009/12/22
- Re: stdlib tweak, Jim Meyering, 2009/12/23
- Re: stdlib tweak, Bruno Haible, 2009/12/23
- Re: stdlib tweak, Eric Blake, 2009/12/23
- Re: ASSERT and _GL_UNUSED macros, Bruno Haible, 2009/12/23
- Re: ASSERT and _GL_UNUSED macros, Eric Blake, 2009/12/23
- Re: ASSERT macro, Bruno Haible, 2009/12/23
- Re: _GL_UNUSED macro, Bruno Haible, 2009/12/23
- new module 'unused-parameter', Bruno Haible, 2009/12/24
- Re: new module 'unused-parameter',
Bruno Haible <=
- Re: new module 'unused-parameter', Jim Meyering, 2009/12/25
- Re: new module 'unused-parameter', Bruno Haible, 2009/12/25
- Re: new module 'unused-parameter', Simon Josefsson, 2009/12/27
- Re: new module 'unused-parameter', Simon Josefsson, 2009/12/29
- Re: new module 'unused-parameter', Jim Meyering, 2009/12/29
- Re: stdlib tweak, Jim Meyering, 2009/12/23
- Re: stdlib tweak, Bruno Haible, 2009/12/23
- Re: stdlib tweak, Eric Blake, 2009/12/23
- Re: stdlib tweak, Eric Blake, 2009/12/23
- Re: ASSERT and SIGNATURE_CHECK macros, Bruno Haible, 2009/12/23