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

john <[email protected]>
Newsgroups gmane.comp.gnome.apps.gnucash.devel
Message-ID <[email protected]>

> On Feb 18, 2022, at 8:24 PM, Kevin Buckley <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.