Hi Tim, is there any appetite to convert the pre ...
# magic
d
Hi Tim, is there any appetite to convert the pre C89 standard K&R style function declarations into the post C89 style ? C23 makes the feature obsolete two actions would occur, • header file function declarations and forward declarations would be converted to introduce argument list, • the functions implementation themselves would be converted If so I'll see if I can automate the process but need some kind of style guidance of the preferred form. `bplane/**`has a style, that has variable leading whitespace indent (not my preferred style and maybe more difficult to automate) Or maybe remove the parenthesis, replace semi-colon with comma, and put back parenthesis (the open parenthesis in the original place, the close parenthesis at the location of the last semi-colon of the last argument in K&R style), which will generate an easier to review patchset. I'll post some what-if examples. Compiling project with a bleeding edge cc generates 10k+ warning over this now. https://en.wikipedia.org/wiki/C23_(C_standard_revision) (see obsolete near the bottom)
database/DBcellname.c:
/* K&R style prototype */
int dbOrientUseFunc();
becomes:
int dbOrientUseFunc(CellUse *selUse, CellUse *use, Transform *transform, ClientData data);
/* adding enough fictitious arguments to need 2nd line might look like */
int dbOrientUseFunc(CellUse *selUse, CellUse *use, Transform *transform, ClientData data, unsigned int extra1,
unsigned int extra2, unsigned int extra3);
database/DBcell.c:
/* K&R style function */
CellUse *
DBCellFindDup(use, parent)
CellUse *use;               /* Use that is about to be placed in parent.
* Is it a duplicate?
*/
CellDef *parent;            /* Parent definiton:  does it already have
* something identical to use?
*/
{
becomes:
/* this form should make bulk review easier if single char change highlighting is available */
CellUse *
DBCellFindDup(
CellUse *use,               /* Use that is about to be placed in parent.
* Is it a duplicate?
*/
CellDef *parent)            /* Parent definiton:  does it already have
* something identical to use?
*/
{
t
As you might expect, this has never been done in the past because there are hundreds of files with thousands of lines to convert and check. Recent automation capabilities should make this a lot easier. There are multiple styles; the "bplane" stuff comes from the open source version of micromagic, so that was a different development team; the various authors of magic have their own distinct styles; but John Ousterhout's programming style dominates the code and I try to stick to it as much as possible, and also convert the other styles to it when I can. Indentation is 4 spaces, with every 8 spaces replaced by a tab character. A brace character (
{
) starts on a new line (I've never been particularly fond of that one).