From e92c451fdb3696886ef19bf8cd500ebabea046ae Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 20 Sep 2025 10:59:28 +0100 Subject: [PATCH] Rename bool, false and true identifiers to avoid clashes GCC-15 has different defaults which mean we can't use these names as normal identifiers. Signed-off-by: Ian Jackson --- conffile.c | 50 ++++++++++++++++++++++++------------------------ debian/changelog | 3 ++- dh.c | 2 +- random.c | 2 +- rsa.c | 2 +- secnet.h | 2 +- 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/conffile.c b/conffile.c index 8c4385c..1549c0f 100644 --- a/conffile.c +++ b/conffile.c @@ -478,8 +478,8 @@ static dict_t *process_config(struct p_node *c) dict_t *root; dict_t *context; item_t *i; - list_t *false; - list_t *true; + list_t *false_; + list_t *true_; root=dict_new(NULL); context=root; @@ -489,29 +489,29 @@ static dict_t *process_config(struct p_node *c) length, so they line up nicely... thanks VKC and SGT (who also point out that "mayhap" is a good "maybe" value as well) */ i=new_item(t_bool,no_loc); - i->data.bool=False; - false=list_append(NULL,i); + i->data.bool_=False; + false_=list_append(NULL,i); i=new_item(t_bool,no_loc); - i->data.bool=True; - true=list_append(NULL,i); - dict_add(root,"false",false); - dict_add(root,"False",false); - dict_add(root,"FALSE",false); - dict_add(root,"no",false); - dict_add(root,"No",false); - dict_add(root,"NO",false); - dict_add(root,"nowise",false); - dict_add(root,"Nowise",false); - dict_add(root,"NOWISE",false); - dict_add(root,"true",true); - dict_add(root,"True",true); - dict_add(root,"TRUE",true); - dict_add(root,"yes",true); - dict_add(root,"Yes",true); - dict_add(root,"YES",true); - dict_add(root,"verily",true); - dict_add(root,"Verily",true); - dict_add(root,"VERILY",true); + i->data.bool_=True; + true_=list_append(NULL,i); + dict_add(root,"false",false_); + dict_add(root,"False",false_); + dict_add(root,"FALSE",false_); + dict_add(root,"no",false_); + dict_add(root,"No",false_); + dict_add(root,"NO",false_); + dict_add(root,"nowise",false_); + dict_add(root,"Nowise",false_); + dict_add(root,"NOWISE",false_); + dict_add(root,"true",true_); + dict_add(root,"True",true_); + dict_add(root,"TRUE",true_); + dict_add(root,"yes",true_); + dict_add(root,"Yes",true_); + dict_add(root,"YES",true_); + dict_add(root,"verily",true_); + dict_add(root,"Verily",true_); + dict_add(root,"VERILY",true_); add_closure(root,"makelist",makelist); add_closure(root,"readfile",readfile); @@ -762,7 +762,7 @@ bool_t dict_read_bool(dict_t *dict, cstring_t key, bool_t required, if (i->type!=t_bool) { cfgfatal(loc,desc,"\"%s\" must be a boolean\n",key); } - r=i->data.bool; + r=i->data.bool_; return r; } diff --git a/debian/changelog b/debian/changelog index 611ab03..5cd9a01 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ secnet (0.6.8~) unstable; urgency=medium - * + * Avoid using `bool`, `false` and `true` as identifiers. + Fixes conflicts with modern C and GCC-15. Closes: #1097866. -- diff --git a/dh.c b/dh.c index 261209a..aebcb06 100644 --- a/dh.c +++ b/dh.c @@ -146,7 +146,7 @@ static list_t *dh_apply(closure_t *self, struct cloc loc, dict_t *context, } i=list_elem(args,2); - if (i && i->type==t_bool && i->data.bool==False) { + if (i && i->type==t_bool && i->data.bool_==False) { Message(M_INFO,"diffie-hellman (%s:%d): skipping modulus " "primality check\n",loc.file,loc.line); } else { diff --git a/random.c b/random.c index 323fffd..65b540a 100644 --- a/random.c +++ b/random.c @@ -82,7 +82,7 @@ static list_t *random_apply(closure_t *self, struct cloc loc, cfgfatal(arg2->loc,"randomsource", "blocking parameter (arg2) must be bool\n"); } - st->ops.blocking=arg2->data.bool; + st->ops.blocking=arg2->data.bool_; } if (!filename) { diff --git a/rsa.c b/rsa.c index efcb650..c52dec9 100644 --- a/rsa.c +++ b/rsa.c @@ -803,7 +803,7 @@ static list_t *rsapriv_apply(closure_t *self, struct cloc loc, dict_t *context, bool_t do_validity_check=True; i=list_elem(args,1); - if (i && i->type==t_bool && i->data.bool==False) { + if (i && i->type==t_bool && i->data.bool_==False) { Message(M_INFO,"rsa-private (%s:%d): skipping RSA key validity " "check\n",loc.file,loc.line); do_validity_check=False; diff --git a/secnet.h b/secnet.h index 79a3fc4..99d00ba 100644 --- a/secnet.h +++ b/secnet.h @@ -160,7 +160,7 @@ enum types { t_null, t_bool, t_string, t_number, t_dict, t_closure }; struct item { enum types type; union { - bool_t bool; + bool_t bool_; string_t string; uint32_t number; dict_t *dict; -- 2.30.2