mirror of
https://github.com/SELinuxProject/setools
synced 2025-03-25 04:26:28 +00:00
Improve libqpol yyerror/yywarn prototypes
* Add printf format specifier for yyerror2 to be able to use "gcc -Wformat-security" * Constify message string to avoid gcc warnings about casting string literals to non-const char*.
This commit is contained in:
parent
7aace4d52a
commit
35722ab22d
@ -47,8 +47,9 @@ typedef struct scope_stack {
|
||||
|
||||
extern policydb_t *policydbp;
|
||||
extern queue_t id_queue;
|
||||
extern int yyerror(char *msg);
|
||||
extern void yyerror2(char *fmt, ...);
|
||||
extern int yyerror(const char *msg);
|
||||
__attribute__ ((format(printf, 1, 2)))
|
||||
extern void yyerror2(const char *fmt, ...);
|
||||
|
||||
static int push_stack(int stack_type, ...);
|
||||
static void pop_stack(void);
|
||||
|
@ -81,8 +81,8 @@ extern unsigned long policydb_lineno;
|
||||
extern unsigned long source_lineno;
|
||||
extern unsigned int policydb_errors;
|
||||
|
||||
extern int yywarn(char *msg);
|
||||
extern int yyerror(char *msg);
|
||||
extern int yywarn(const char *msg);
|
||||
extern int yyerror(const char *msg);
|
||||
|
||||
#define ERRORMSG_LEN 255
|
||||
static char errormsg[ERRORMSG_LEN + 1] = {0};
|
||||
@ -104,7 +104,8 @@ void init_parser(int pass_number, int do_rules)
|
||||
num_rules = 0;
|
||||
}
|
||||
|
||||
void yyerror2(char *fmt, ...)
|
||||
__attribute__ ((format(printf, 1, 2)))
|
||||
void yyerror2(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -76,8 +76,8 @@ extern unsigned int pass;
|
||||
|
||||
extern char yytext[];
|
||||
extern int yylex(void);
|
||||
extern int yywarn(char *msg);
|
||||
extern int yyerror(char *msg);
|
||||
extern int yywarn(const char *msg);
|
||||
extern int yyerror(const char *msg);
|
||||
|
||||
typedef int (* require_func_t)();
|
||||
|
||||
|
@ -47,7 +47,7 @@ typedef int (* require_func_t)();
|
||||
|
||||
static char linebuf[2][255];
|
||||
static unsigned int lno = 0;
|
||||
int yywarn(char *msg);
|
||||
int yywarn(const char *msg);
|
||||
|
||||
void set_source_file(const char *name);
|
||||
|
||||
@ -310,7 +310,7 @@ int yyerror(char *msg)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int yywarn(char *msg)
|
||||
int yywarn(const char *msg)
|
||||
{
|
||||
if (source_file[0])
|
||||
fprintf(stderr, "%s:%ld:",
|
||||
|
Loading…
Reference in New Issue
Block a user