Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: rpki-client: zap trailing ';' when using certain asn1t.h macros
To:
Job Snijders <job@openbsd.org>
Cc:
tech@openbsd.org
Date:
Sat, 6 Sep 2025 15:02:57 +0200

Download raw body.

Thread
On Sat, Sep 06, 2025 at 12:55:32PM +0000, Job Snijders wrote:
> On Sat, Sep 06, 2025 at 02:50:58PM +0200, Theo Buehler wrote:
> > On Sat, Sep 06, 2025 at 12:08:26PM +0000, Job Snijders wrote:
> > > I learned that the openssl/asn1t.h ASN1_SEQUENCE_END and
> > > ASN1_ITEM_TEMPLATE_END macros already add a semi-colon.
> > 
> > It is annoying and makes my eyes bleed either way. I think nothing
> > really cares about this except -Wpedantic. I think we can keep the ;.
> > IMPLEMENT_ASN1_FUNCTIONS() also adds a ; by the way.
> 
> the generous documentation example in asn1t.h lines 127-142 doesn't
> contain trailing ';' - so my thinking was to align with that.

I misspoke. It provides function definitions, so adding a ; will also
result in a ; that doesn't really belong ther and result in -Wpedantic
triggering -Wextra-semi.

> but perhaps for consistency?

Yes, I think this is easier on the eyes.

> 
> Index: ccr.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/rpki-client/ccr.c,v
> diff -u -p -r1.3 ccr.c
> --- ccr.c	6 Sep 2025 11:55:44 -0000	1.3
> +++ ccr.c	6 Sep 2025 12:53:28 -0000
> @@ -155,7 +155,7 @@ IMPLEMENT_ASN1_FUNCTIONS(ManifestState);
>  
>  ASN1_ITEM_TEMPLATE(ManifestRefs) =
>      ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, mftrefs, ManifestRef)
> -ASN1_ITEM_TEMPLATE_END(ManifestRefs)
> +ASN1_ITEM_TEMPLATE_END(ManifestRefs);
>  
>  IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(ManifestRefs, ManifestRefs, ManifestRefs);
>  
> @@ -178,7 +178,7 @@ IMPLEMENT_ASN1_FUNCTIONS(ROAPayloadState
>  
>  ASN1_ITEM_TEMPLATE(ROAPayloadSets) =
>      ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, rps, ROAPayloadSet)
> -ASN1_ITEM_TEMPLATE_END(ROAPayloadSets)
> +ASN1_ITEM_TEMPLATE_END(ROAPayloadSets);
>  
>  IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(ROAPayloadSets, ROAPayloadSets,
>      ROAPayloadSets);
> @@ -226,7 +226,7 @@ IMPLEMENT_ASN1_FUNCTIONS(TrustAnchorStat
>  ASN1_ITEM_TEMPLATE(SubjectKeyIdentifiers) =
>  	ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, tas,
>  	    SubjectKeyIdentifier)
> -ASN1_ITEM_TEMPLATE_END(SubjectKeyIdentifiers)
> +ASN1_ITEM_TEMPLATE_END(SubjectKeyIdentifiers);
>  
>  IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(SubjectKeyIdentifiers,
>      SubjectKeyIdentifiers, SubjectKeyIdentifiers);