Convert K&R function definitions to ANSI C; fix GCC 16 / C23 build#526
Convert K&R function definitions to ANSI C; fix GCC 16 / C23 build#526gonsolo wants to merge 26 commits into
Conversation
|
AI generated, yes this could have been done this way a while ago using such a method. Please take a look at the commit history for similar work done to the standard we are looking for. This does not follow a number of already established source conventions in the project. FWIW I do have the over 10 subdirs already converted, as we are finding out with AI, the time sink is in QA and testing (not creating/modifying code) and the only reason it has not been released sooner is that it hasn't passed my own standards for QA for release. Maybe specific compiler (GCC16) concerns can be fixed with |
d32aa41 to
fce7b5c
Compare
This uses c17 to keep the changes small (ahem). Later standards can be done subsequently.
Ok.
I told Claude to write a smoke test (it's in the commit message). I was looking for a testsuite but didn't find one, that's the real QA in my opinion. Claude could be told to emit one for every line he changed and test it before and after the conversion. That and two or more humans looking over the code and testsuite would be a real improvement. |
|
@gonsolo : As far as "established source conventions", please look at, for example, something like cif/CIFwrite.c line 118. The question is not one of syntax but of style: Each argument is on a separate line, indented four spaces. An explanation of each argument (if available) follows on the same line. The return value type is on a separate line above the routine name. Arguments which are unused are so stated in the comment. If the style is followed, then I am okay with reviewing and approving fixes in batches of up to a few hundred at a time. Darryl has been feeding me fixes one directory at a time, which I think is a good practice. |
GCC 16 defaults to C23, where "()" in a function declaration means "(void)" rather than "unspecified arguments". That breaks the many legacy K&R-style "()" declarations still present throughout the tree, independently of the K&R-to-ANSI conversion that follows in subsequent per-directory commits. Add -std=gnu17 (single dash; clang silently ignores the "--std=" long form some CI scripts pass) in the gcc SHLIB_CFLAGS block and the emscripten target to restore C17 semantics, and drop the now-unnecessary -Wno-implicit-int suppression from the emscripten target. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in utils/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Updates the utils headers (netlist.h, stack.h, undo.h, macros.h) to prototype the affected declarations. TechAddClient keeps a generic (unprototyped) declaration because its per-section callbacks have intentionally varying signatures; its "opt" parameter is typed int (not bool) so the empty-parameter-list declaration stays compatible with the prototyped definition under C23. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in database/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Updates the database prototypes through the database.h.in template (database.h is generated) and adds a forward typedef for FontChar so those prototypes need not pull in database/fonts.h. Also fixes a latent bug exposed by the now-checked prototype: dbStampFunc was defined with two parameters but called recursively with one. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in graphics/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Adds a forward typedef for TileType in graphics.h so the GrClipTriangle prototype can name it without creating a circular include with the database layer. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in dbwind/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Updates dbwind.h, including a prototype for the combined DBWloadWindow declaration. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in textio/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in tcltk/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in drc/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Updates drc.h with prototypes for the affected declarations. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in extflat/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Updates the extflat headers (extflat.h, EFint.h) to prototype the affected declarations. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in extract/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Updates the extract headers (extract.h, extractInt.h). Where the generically-typed node-name callback field is assigned the now-prototyped extArrayTileToNode / extSubtreeTileToNode, the assignment is cast to the field's function-pointer type. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in select/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Updates select.h with prototypes for the affected declarations. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in gcr/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Updates gcr.h with prototypes for the affected declarations. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in router/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Updates the router headers (router.h, routerInt.h) and adds forward typedefs for the netlist types (NLTermLoc, NLTerm, NLNet) named by the new prototypes. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in grouter/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Updates grouter.h with prototypes for the affected declarations. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in mzrouter/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in garouter/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Updates garouter.h. Callbacks passed to generic function-pointer parameters (RtrStemProcessAll, the split-paint-plane hook) are cast to the expected pointer type at the call sites. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in irouter/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Updates irInternal.h with prototypes for the affected declarations. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in lisp/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in plow/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in plot/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in resis/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in netmenu/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in debug/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Corrects the HistCreate / HistAdd declarations in debug.h to use bool for the ptrKeys parameter, matching their definitions. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in windows/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Updates the windows headers (windows.h, windInt.h) to prototype the affected declarations. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in commands/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert the old-style (K&R) function definitions in oa/ to ANSI C prototypes, formatted in the project's convention: the return type on its own line and each parameter on its own line, indented four spaces, with the original parameter comments retained. Builds cleanly under GCC 16 / C23 (with the -std=gnu17 build change). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fce7b5c to
435daea
Compare
|
@RTimothyEdwards thanks for the style guidance — I've reworked the PR to follow it.
Verified with a clean-from-scratch GCC 16 build: 0 errors (only the same benign If the format looks right on, say, the |
Converts the old-style (K&R) function definitions across the tree to ANSI C
prototypes, formatted in the project's convention — the return type on its own
line, and each parameter on its own line indented four spaces with its original
comment retained — and adds the
-std=gnu17flag needed for the GCC 16 / C23build.
The change is organized as one commit per directory on top of a single
buildcommit, in dependency order (low-level first). Each directory commitbundles its own header changes together with its definitions, so it is
self-consistent and every prefix of the series builds; it can be reviewed and
merged a directory at a time.
require them (
FontChar,TileType, the netlist types); generic callbacks(e.g.
TechAddClient) kept unprototyped; callback casts added where typedfunctions are stored in generic
(*)()slots.dbStampFuncwas defined with two parameters but calledrecursively with one (hidden by the old K&R declaration).
Verified with a clean-from-scratch GCC 16 build: 0 errors, only the same benign
-Wdiscarded-qualifierswarnings as before;tclmagic.solinks.