Herbert J. Skuhra via Postfix-devel:
> Hi Wietse,
> 
> On Thu, 15 Feb 2024 15:18:20 +0100, Wietse Venema via Postfix-devel wrote:
> > 
> > Herbert J. Skuhra via Postfix-devel:
> > > Hi,
> > > 
> > > I am trying to build Postfix-3.9 (20240213) with MongoDB support.
> > > Using clang the build fails:
> > > 
> > > dict_mongodb.c:258:6: error: expected expression
> > >   258 |             const uint8_t *dataBuffer = NULL;
> > >       |             ^
> > 
> > uint8_t is defined with inttypes.h which is included in dict_mongodb.c.
> > 
> > Perhaps the compiler does not like a declaration after case label,
> > in that case try adding { and } around the code in the BSON_TYPE_ARRAY
> > case:
> > 
> >     case BSON_TYPE_ARRAY: 
> >     { // ADD THIS LINE
> >         const uint8_t *dataBuffer = NULL;
> >         /* other existing code */
> >     } // ADD THIS LINE
> >     default:
> 
> Yeah, this change resolves the issue. Thanks a lot!

And there is an even simpler workaround: an empty statement.

     case BSON_TYPE_ARRAY:
         /* Empty statement for pre-C23 Clang. */ ;
         const uint8_t *dataBuffer = NULL;
         /* other existing code */
     default:

No {} trickery needed.

Can you confirm this? 

        Wietse
_______________________________________________
Postfix-devel mailing list -- postfix-devel@postfix.org
To unsubscribe send an email to postfix-devel-le...@postfix.org

Reply via email to