Convert K&R function definitions to ANSI C; fix GCC 16 / C23 build#1
Open
gonsolo wants to merge 26 commits into
Open
Convert K&R function definitions to ANSI C; fix GCC 16 / C23 build#1gonsolo wants to merge 26 commits into
gonsolo wants to merge 26 commits into
Conversation
d32aa41 to
fce7b5c
Compare
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Converts 1162 old-style (K&R) function definitions to modern ANSI C prototypes across the tree, following the pattern of upstream PR RTimothyEdwards#487, and removes the
-Wno-implicit-intflag that was suppressing the related warnings in the emscripten target.GCC 16 defaults to C23, where
()means(void)rather than "unspecified arguments", which broke the build independently of the K&R conversion. This adds-std=gnu17(indefs.makand the gccSHLIB_CFLAGSblock ofscripts/configure[.in]) to restore C17 semantics so the many remaining legacy()declarations keep compiling.Errors fixed after the conversion
()declaration is incompatible with a prototype whose parameters undergo default promotion (bool,float), so these needed explicit signatures.MagWindow,GrGlyph,TxCommand,NLNetList,cellUE,struct inarg) where the type wasn't visible, including to break circular header includes.WindAddClient,WindSearch,GrLockPtr/GrUnlockPtr) back to()— their callbacks have intentionally varying return types and take no promotable scalar args.extern int wind*Cmd()declarations that should bevoid, theDebugSetbool/int parameter mismatch, typed func pointers in CmdCD and PlowRules3, and comparator/callback casts forqsort,extEnumTilePerim, and the Tk/TOGL lock pointers.Verification
make clean+make -j -k): 0 errors, exit 0. Only warnings are 18 benign-Wdiscarded-qualifiers(const pointers passed to newly-typed prototypes that don't declare const; callees don't mutate).tclmagic.soloads andmagic::initialize -dnull -noconsolesucceeds.scmos.techexercised the most heavily-converted files, all correct:tech load(DBtech*.c)drc check(DRCbasic.c, DRCtech.c)extract all→realtest.ext(ExtBasic.c/ExtMain.c, incl. theextEnumTilePerimcallback cast)save→ reload disk round-trip preserving all layer types (DBio.c read + write)Not covered by the smoke test (compiled and loaded, but not executed): the routers (grouter/mzrouter/garouter/irouter), GDS/CIF/LEF I/O, plotting, and 3D. A valid-but-wrong type in one of those untested paths would not have been caught at runtime, though the clean build rules out most mis-typings (which surface as compile errors).
🤖 Generated with Claude Code