mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
C tools: rename __unused macro to unused
Bug: https://bugzilla.novell.com/show_bug.cgi?id=895495 We define the __unused macro as a shortcut for __attribute__((unused)) to quiet compiler warnings for functions where an argument is unused, for whatever reason. However, on 64 bit architectures, older glibc's bits/stat.h header defines an array variable with the name __unused that collides with our macro and causes the parser to fail to build, because the resulting macro expansion generates invalid C code. This commit fixes the issue by removing the __unused macro where it's not needed (mod_apparmor) and renaming it to 'unused' elsewhere. It also in some instances reorders the arguments so that the unused macro appears last consistently. Signed-off-by: Steve Beattie <steve@nxnw.org> Acked-by: Seth Arnold <seth.arnold@canonical.com> Acked-by: John Johansen <john.johansen@canonical.com> Acked-by: Tyler Hicks <tyhicks@canonical.com>
This commit is contained in:
parent
ce70c84f5c
commit
a44b6ce0a2
@ -29,9 +29,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
/* #define DEBUG */
|
/* #define DEBUG */
|
||||||
#ifndef __unused
|
|
||||||
#define __unused __attribute__((unused))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* should the following be configurable? */
|
/* should the following be configurable? */
|
||||||
#define DEFAULT_HAT "HANDLING_UNTRUSTED_INPUT"
|
#define DEFAULT_HAT "HANDLING_UNTRUSTED_INPUT"
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
virtual ostream &dump(ostream &os);
|
virtual ostream &dump(ostream &os);
|
||||||
virtual int expand_variables(void);
|
virtual int expand_variables(void);
|
||||||
virtual int gen_policy_re(Profile &prof) = 0;
|
virtual int gen_policy_re(Profile &prof) = 0;
|
||||||
virtual void post_process(Profile &prof __unused) { };
|
virtual void post_process(Profile &prof unused) { };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __AA_AF_RULE_H */
|
#endif /* __AA_AF_RULE_H */
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
virtual ostream &dump_peer(ostream &os);
|
virtual ostream &dump_peer(ostream &os);
|
||||||
virtual int expand_variables(void);
|
virtual int expand_variables(void);
|
||||||
virtual int gen_policy_re(Profile &prof);
|
virtual int gen_policy_re(Profile &prof);
|
||||||
virtual void post_process(Profile &prof __unused) { };
|
virtual void post_process(Profile &prof unused) { };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __AA_AF_UNIX_H */
|
#endif /* __AA_AF_UNIX_H */
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
virtual ostream &dump(ostream &os);
|
virtual ostream &dump(ostream &os);
|
||||||
virtual int expand_variables(void);
|
virtual int expand_variables(void);
|
||||||
virtual int gen_policy_re(Profile &prof);
|
virtual int gen_policy_re(Profile &prof);
|
||||||
virtual void post_process(Profile &prof __unused) { };
|
virtual void post_process(Profile &prof unused) { };
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -386,7 +386,7 @@ static struct value_list *extract_options(struct cond_entry **conds, int eq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mnt_rule::mnt_rule(struct cond_entry *src_conds, char *device_p,
|
mnt_rule::mnt_rule(struct cond_entry *src_conds, char *device_p,
|
||||||
struct cond_entry *dst_conds __unused, char *mnt_point_p,
|
struct cond_entry *dst_conds unused, char *mnt_point_p,
|
||||||
int allow_p):
|
int allow_p):
|
||||||
mnt_point(mnt_point_p), device(device_p), trans(NULL), opts(NULL),
|
mnt_point(mnt_point_p), device(device_p), trans(NULL), opts(NULL),
|
||||||
flags(0), inv_flags(0), audit(0), deny(0)
|
flags(0), inv_flags(0), audit(0), deny(0)
|
||||||
|
@ -127,7 +127,7 @@ public:
|
|||||||
int deny;
|
int deny;
|
||||||
|
|
||||||
mnt_rule(struct cond_entry *src_conds, char *device_p,
|
mnt_rule(struct cond_entry *src_conds, char *device_p,
|
||||||
struct cond_entry *dst_conds __unused, char *mnt_point_p,
|
struct cond_entry *dst_conds unused, char *mnt_point_p,
|
||||||
int allow_p);
|
int allow_p);
|
||||||
virtual ~mnt_rule()
|
virtual ~mnt_rule()
|
||||||
{
|
{
|
||||||
@ -141,7 +141,7 @@ public:
|
|||||||
virtual ostream &dump(ostream &os);
|
virtual ostream &dump(ostream &os);
|
||||||
virtual int expand_variables(void);
|
virtual int expand_variables(void);
|
||||||
virtual int gen_policy_re(Profile &prof);
|
virtual int gen_policy_re(Profile &prof);
|
||||||
virtual void post_process(Profile &prof __unused);
|
virtual void post_process(Profile &prof unused);
|
||||||
};
|
};
|
||||||
|
|
||||||
int is_valid_mnt_cond(const char *name, int src);
|
int is_valid_mnt_cond(const char *name, int src);
|
||||||
|
@ -183,8 +183,8 @@ extern int preprocess_only;
|
|||||||
#define MIN_PORT 0
|
#define MIN_PORT 0
|
||||||
#define MAX_PORT 65535
|
#define MAX_PORT 65535
|
||||||
|
|
||||||
#ifndef __unused
|
#ifndef unused
|
||||||
#define __unused __attribute__ ((unused))
|
#define unused __attribute__ ((unused))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ static char *do_alias(struct alias_rule *alias, const char *target)
|
|||||||
|
|
||||||
static Profile *target_prof;
|
static Profile *target_prof;
|
||||||
static struct cod_entry *target_list;
|
static struct cod_entry *target_list;
|
||||||
static void process_entries(const void *nodep, VISIT value, int __unused level)
|
static void process_entries(const void *nodep, VISIT value, int level unused)
|
||||||
{
|
{
|
||||||
struct alias_rule **t = (struct alias_rule **) nodep;
|
struct alias_rule **t = (struct alias_rule **) nodep;
|
||||||
struct cod_entry *entry, *dup = NULL;
|
struct cod_entry *entry, *dup = NULL;
|
||||||
@ -150,7 +150,7 @@ static void process_entries(const void *nodep, VISIT value, int __unused level)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process_name(const void *nodep, VISIT value, int __unused level)
|
static void process_name(const void *nodep, VISIT value, int level unused)
|
||||||
{
|
{
|
||||||
struct alias_rule **t = (struct alias_rule **) nodep;
|
struct alias_rule **t = (struct alias_rule **) nodep;
|
||||||
Profile *prof = target_prof;
|
Profile *prof = target_prof;
|
||||||
|
@ -119,7 +119,7 @@ struct cb_struct {
|
|||||||
const char *filename;
|
const char *filename;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int include_dir_cb(__unused DIR *dir, const char *name, struct stat *st,
|
static int include_dir_cb(DIR *dir unused, const char *name, struct stat *st,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct cb_struct *d = (struct cb_struct *) data;
|
struct cb_struct *d = (struct cb_struct *) data;
|
||||||
|
@ -1026,7 +1026,7 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* data - name of parent dir */
|
/* data - name of parent dir */
|
||||||
static int profile_dir_cb(__unused DIR *dir, const char *name, struct stat *st,
|
static int profile_dir_cb(DIR *dir unused, const char *name, struct stat *st,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@ -1043,7 +1043,7 @@ static int profile_dir_cb(__unused DIR *dir, const char *name, struct stat *st,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* data - name of parent dir */
|
/* data - name of parent dir */
|
||||||
static int binary_dir_cb(__unused DIR *dir, const char *name, struct stat *st,
|
static int binary_dir_cb(DIR *dir unused, const char *name, struct stat *st,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@ -1060,7 +1060,7 @@ static int binary_dir_cb(__unused DIR *dir, const char *name, struct stat *st,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int clear_cache_cb(DIR *dir, const char *path, struct stat *st,
|
static int clear_cache_cb(DIR *dir, const char *path, struct stat *st,
|
||||||
__unused void *data)
|
void *data unused)
|
||||||
{
|
{
|
||||||
/* remove regular files */
|
/* remove regular files */
|
||||||
if (S_ISREG(st->st_mode))
|
if (S_ISREG(st->st_mode))
|
||||||
|
@ -183,7 +183,7 @@ static struct keyword_table rlimit_table[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* for alpha matches, check for keywords */
|
/* for alpha matches, check for keywords */
|
||||||
static int get_table_token(const char *name __unused, struct keyword_table *table,
|
static int get_table_token(const char *name unused, struct keyword_table *table,
|
||||||
const char *keyword)
|
const char *keyword)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -342,7 +342,7 @@ void warn_uppercase(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_sub_mode(const char *str_mode, const char *mode_desc __unused)
|
static int parse_sub_mode(const char *str_mode, const char *mode_desc unused)
|
||||||
{
|
{
|
||||||
|
|
||||||
#define IS_DIFF_QUAL(mode, q) (((mode) & AA_MAY_EXEC) && (((mode) & AA_EXEC_TYPE) != ((q) & AA_EXEC_TYPE)))
|
#define IS_DIFF_QUAL(mode, q) (((mode) & AA_MAY_EXEC) && (((mode) & AA_EXEC_TYPE) != ((q) & AA_EXEC_TYPE)))
|
||||||
@ -529,7 +529,7 @@ int parse_mode(const char *str_mode)
|
|||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_X_sub_mode(const char *X, const char *str_mode, int *result, int fail, const char *mode_desc __unused)
|
static int parse_X_sub_mode(const char *X, const char *str_mode, int *result, int fail, const char *mode_desc unused)
|
||||||
{
|
{
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
@ -495,7 +495,7 @@ out:
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void expand_variable(const void *nodep, VISIT value, int __unused level)
|
static void expand_variable(const void *nodep, VISIT value, int level unused)
|
||||||
{
|
{
|
||||||
struct symtab **t = (struct symtab **) nodep;
|
struct symtab **t = (struct symtab **) nodep;
|
||||||
|
|
||||||
@ -547,7 +547,7 @@ static void __dump_symtab_entry(struct symtab *entry, int do_expanded)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_symtab_entry(const void *nodep, VISIT value, int __unused level)
|
static void dump_symtab_entry(const void *nodep, VISIT value, int level unused)
|
||||||
{
|
{
|
||||||
struct symtab **t = (struct symtab **) nodep;
|
struct symtab **t = (struct symtab **) nodep;
|
||||||
|
|
||||||
@ -557,7 +557,7 @@ static void dump_symtab_entry(const void *nodep, VISIT value, int __unused level
|
|||||||
__dump_symtab_entry(*t, 0);
|
__dump_symtab_entry(*t, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_expanded_symtab_entry(const void *nodep, VISIT value, int __unused level)
|
static void dump_expanded_symtab_entry(const void *nodep, VISIT value, int level unused)
|
||||||
{
|
{
|
||||||
struct symtab **t = (struct symtab **) nodep;
|
struct symtab **t = (struct symtab **) nodep;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
virtual ostream &dump(ostream &os);
|
virtual ostream &dump(ostream &os);
|
||||||
virtual int expand_variables(void);
|
virtual int expand_variables(void);
|
||||||
virtual int gen_policy_re(Profile &prof);
|
virtual int gen_policy_re(Profile &prof);
|
||||||
virtual void post_process(Profile &prof __unused) { };
|
virtual void post_process(Profile &prof unused) { };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __AA_PTRACE_H */
|
#endif /* __AA_PTRACE_H */
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
virtual ostream &dump(ostream &os);
|
virtual ostream &dump(ostream &os);
|
||||||
virtual int expand_variables(void);
|
virtual int expand_variables(void);
|
||||||
virtual int gen_policy_re(Profile &prof);
|
virtual int gen_policy_re(Profile &prof);
|
||||||
virtual void post_process(Profile &prof __unused) { };
|
virtual void post_process(Profile &prof unused) { };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __AA_SIGNAL_H */
|
#endif /* __AA_SIGNAL_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user