[GNC-dev] Missing G_END_DECLS macro in gnucash/import-export/aqb/gnc-ab-kvp.h

john jralls at ceridwen.us
Sat Feb 19 13:05:11 EST 2022



> On Feb 18, 2022, at 8:24 PM, Kevin Buckley <kevin.m.buckley at gmail.com> wrote:
> 
> I actually noticed this in a source file from back in the 2.6 days,
> although have just pull-ed the maint branch, at commit 1ed85c9b6,
> and still can't see one?
> 
> FWIW, I was looking to wrap all of the
> 
> G_BEGIN_DECLS
> G_END_DECLS
> 
> pairs in GNU indent "Ignore" comments
> 
> /* *INDENT-OFF* */
> 
> /* *INDENT-ON* */
> 
> (indent not being overly happy dealing with them nor with G_GNUC_CONST
> come to that),
> 
> and noticed this file had a BEGIN-ing but no END.
> 
> Was wondering if that was "correct" or merely just "OK"?
> 
> 
> Just out of interest though, and leaving aside the "it's a free-for-all" notes
> in the Coding Style Conventions stanza of the HACKING file, what are the
> pretty-printers of choice for the various source code languages within
> the GnuCash codebase?

A G_BEGIN_DECLS without a corresponding G_END_DECLS should fail to compile if it's presented to a c++ compiler. Seems those macros are used mostly in files that aren't likely to ever be presented to a c++ compiler so they should probably be removed; in the few exceptions where a c++ compiler might see them I think it would be better to replace them with their expansions for clarity.

On those occasions where we want to bulk reformat we've generally used artistic style, http://astyle.sourceforge.net/, as
  astyle -xd -k1 -m0 -M60 -xL -xC79 -OHpUcZns4 --brackets=break
or more commonly just
  astyle --indent=spaces=4 --brackets=break --suffix=none

Please refer to https://wiki.gnucash.org/wiki/CodingStandard rather than the ancient instructions in HACKING--which I just replaced with a pointer to the wiki page.

Regards,
John Ralls



More information about the gnucash-devel mailing list