Merge pull request #31 from stkeke/trivial_fix

A serial of trivial fixes in source code
This commit is contained in:
Dmitry Stogov 2023-05-10 14:52:50 +03:00 committed by GitHub
commit c6b5075733
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 7 deletions

2
ir.g
View File

@ -110,7 +110,7 @@ static void report_undefined_var(const char *str, uint32_t len, ir_ref val)
}
}
void ir_check_indefined_vars(ir_parser_ctx *p)
static void ir_check_indefined_vars(ir_parser_ctx *p)
{
ir_strtab_apply(&p->var_tab, report_undefined_var);
exit(2);

3
ir.h
View File

@ -343,6 +343,7 @@ typedef int32_t ir_ref;
#define IR_IS_CONST_REF(ref) ((ref) < 0)
/* IR Constant Value */
#define IR_UNUSED 0
#define IR_NULL (-1)
#define IR_FALSE (-2)
@ -352,7 +353,7 @@ typedef int32_t ir_ref;
#define IR_CONSTS_LIMIT_MIN (-(IR_TRUE - 1))
#define IR_INSNS_LIMIT_MIN (IR_UNUSED + 1)
/* IR Constant Value */
#ifndef IR_64
# define ADDR_MEMBER uintptr_t addr;
#else

View File

@ -92,7 +92,7 @@ static void report_undefined_var(const char *str, uint32_t len, ir_ref val)
}
}
void ir_check_indefined_vars(ir_parser_ctx *p)
static void ir_check_indefined_vars(ir_parser_ctx *p)
{
ir_strtab_apply(&p->var_tab, report_undefined_var);
exit(2);

View File

@ -18,7 +18,7 @@ static void help(const char *cmd)
printf(
"Usage: %s [options] input-file...\n"
"Options:\n"
" -O[012] - optimiztion level\n"
" -O[012] - optimiztion level (default: 2)\n"
" -S - dump final target assembler code\n"
#if defined(IR_TARGET_X86) || defined(IR_TARGET_X64)
" -mavx - use AVX instruction set\n"
@ -381,8 +381,8 @@ int main(int argc, char **argv)
return 1;
}
if ((mflags & IR_X86_AVX) & !(cpuinfo & IR_X86_AVX)) {
fprintf(stderr, "ERROR: -mAVX is not compatible with CPU (AVX is not supported)\n");
if ((mflags & IR_X86_AVX) && !(cpuinfo & IR_X86_AVX)) {
fprintf(stderr, "ERROR: -mavx is not compatible with CPU (AVX is not supported)\n");
return 1;
}
#endif

View File

@ -16,7 +16,7 @@ typedef struct _ir_strtab_bucket {
ir_ref val;
} ir_strtab_bucket;
uint32_t ir_str_hash(const char *str, size_t len)
static uint32_t ir_str_hash(const char *str, size_t len)
{
size_t i;
uint32_t h = 5381;