Generate an error when a function is redefined
Use one more bit in AttributeDef to differenciate between declared
function (only its prototype is known) and defined function (its body is
also known). This allows to generate an error in cases like:
int f(){return 0;}
int f(){return 1;}
This commit is contained in:
4
tcc.h
4
tcc.h
@ -389,9 +389,10 @@ typedef struct AttributeDef {
|
||||
func_export : 1,
|
||||
func_import : 1,
|
||||
func_args : 5,
|
||||
func_proto : 1,
|
||||
mode : 4,
|
||||
weak : 1,
|
||||
fill : 11;
|
||||
fill : 10;
|
||||
struct Section *section;
|
||||
int alias_target; /* token */
|
||||
} AttributeDef;
|
||||
@ -401,6 +402,7 @@ typedef struct AttributeDef {
|
||||
#define FUNC_EXPORT(r) (((AttributeDef*)&(r))->func_export)
|
||||
#define FUNC_IMPORT(r) (((AttributeDef*)&(r))->func_import)
|
||||
#define FUNC_ARGS(r) (((AttributeDef*)&(r))->func_args)
|
||||
#define FUNC_PROTO(r) (((AttributeDef*)&(r))->func_proto)
|
||||
#define FUNC_ALIGN(r) (((AttributeDef*)&(r))->aligned)
|
||||
#define FUNC_PACKED(r) (((AttributeDef*)&(r))->packed)
|
||||
#define ATTR_MODE(r) (((AttributeDef*)&(r))->mode)
|
||||
|
||||
Reference in New Issue
Block a user