Repository navigation
Fix compiler warnings on GCC 16 - #230
Conversation
midwan
left a comment
There was a problem hiding this comment.
Thanks for this, it's a big cleanup and most of it checks out. I went through the whole diff; CI is green on all platforms, but there's one behaviour regression and one undocumented build-flag change that need addressing before merge.
Blocker
- FTP "Delete All" no longer suppresses further confirmations in
lister_delete()(inline comment below).
Should fix
-Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration -Wno-error=implicit-intwere added to the OS3WARNINGSwithout mention in the PR description, ChangeLog or commit message (inline comment below).
Worth calling out
NewConfigWindow.dimsis nowconstin the public SDK header. The library vectors are fine (I checked SFD, FD, clib, defines, inline, ppcinline, the OS4 interface and the OS4/MOS stubs), but this is a source-compat break for third-party module code that writes throughnewwin.dims->..., exactly whatftp_addressbook.chad to be changed for. Please state that explicitly in the ChangeLog.- "No behaviour change" isn't runtime-verified.
-fno-strict-aliasingchanges codegen for every OS3 binary, and testing covers builds and FTP host tests only. Please do at least one Amiberry run before merge: startup, a lister, FTP delete with confirmations, and the About window (its AROS image byte-swap already broke once on this branch, fixed in 694a111).
Nits
about.c324/363/532/557: the(UWORD *)casts onlogo_image[...]andimage->imagedataare no-ops (both are already non-constUWORD); leftovers from before 694a111. Only the(ULONG *)image->palettecast is needed.eliza.c:37keeps a localstrstriprototype; better to includemisc.hso the two can't drift (that's the kind of thing that produces LTO type-mismatch warnings).lister_rename: removingabortleaves a stray blank line before the closing brace.defines/dopus5.handppcinline/dopus5.h: the macro continuation backslashes are no longer aligned;config_filetypes.h:66has;//without a space. A clang-format pass would sort these.- The PR description lists
GetPointerPkt,InputBase,SwapListNodes, IPC startup functions, the FEAT parser removal and thetimevalinit, but those are already on master via 17e1bfb and aren't in this diff. Worth trimming so the description matches the change.
Verified fine
- The
function_data.cand FTP table rebraces keep order and terminators; thedata.carrow pairs keep all 22 words in order for both images. - The CPU-detection braces match the old dangling-else binding.
- The
lst_dos_errparentheses match existing precedence and the identical condition at line 865. - The AmFTP
*p->amftp_*checks are equivalent: the entry isMEMF_CLEAR. ftp_winwrites are equivalent:newwin.dims = &ftp_winis unconditional.class_stringsasconst UWORD *matchesmatchtype_labels.- The
module_infocasts are safe:commands.conly reads the result.
| TAG_DONE); | ||
| } | ||
|
|
||
| // Delete all? Show no more confirmation requesters |
There was a problem hiding this comment.
This removal changes behaviour. Unlike lister_findfile/lister_getsizes (where confirm_entry is always 1, so quiet really was dead), here quiet is read on the next loop iteration at lines 1775 and 1796 (if (!quiet && ...)). Return value 2 is the MSG_FTP_DELETEALL button, so with the assignment gone, pressing "Delete All" deletes that one entry and then prompts again for every remaining one.
Please restore it here:
// Delete all? Show no more confirmation requesters
if (confirm_entry == 2)
quiet = 1;
if (confirm_entry == 1 || confirm_entry == 2)| endif | ||
|
|
||
| WARNINGS := -Wall -Wno-pointer-sign -Wno-attributes -Wno-int-conversion -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast | ||
| WARNINGS := -Wall -Wno-pointer-sign -Wno-attributes -Wno-int-conversion -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration -Wno-error=implicit-int |
There was a problem hiding this comment.
The three -Wno-error= flags aren't mentioned in the PR description, ChangeLog or the 38b5eb5 commit message. They downgrade GCC 14+'s default errors back to warnings, and via LDFLAGS += $(WARNINGS) they now apply at LTO link time too.
The remaining-warnings list in the description has nothing in these categories, so they don't seem to be needed. Their only effect would be letting a future implicit declaration or pointer mismatch through as a warning, which on m68k with register-based library calls tends to become a runtime bug. Please drop them, or say which build fails without them.
| { | ||
| void *parent; // Parent to open on | ||
| ConfigWindow *dims; // Window dimensions | ||
| const ConfigWindow *dims; // Window dimensions |
There was a problem hiding this comment.
ABI is unchanged, but this is a source-compat break for third-party modules that write through newwin.dims->... (as ftp_addressbook.c did). Fine with me if intentional, but please call it out explicitly in the ChangeLog as affecting module source.
8268b9a to
6e7df4f
Compare
|
🤖 This comment was generated by Claude Code and reviewed by @steen-lund. Thanks for the thorough review, all points taken. Updated in place: each fix is folded into the commit that introduced the problem.
|
|
🤖 This comment was generated by Claude Code and reviewed by @steen-lund. Runtime test on real hardware: Amiga 4000, OS3 release build (
|
|
Thanks, all the points from the last round are sorted. I checked each one against One thing left.
The branch also conflicts with master in I built the merged tree with GCC 6.5 (the CI image) and GCC 16.2.1b. Both build with no errors, and the GCC 16 warnings match the list in the description. |
Brace the union initializer of every CommandList entry and the terminator, and
end the Eliza string tables with {0}.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
(cherry picked from commit f04fb254e4f6821dfa27b6b31964199d032e0a8d)
Remove dead variables, mark debug- or AmigaOS 4-only ones UNUSED, cast the DOSBase argument, and cast isspace() arguments to unsigned char. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> (cherry picked from commit 85a76839961ad2e9b78fdf3720343a29573a8fac)
Cast base and ctype arguments, convert K&R definitions to prototypes, test character arrays for emptiness instead of their address, and remove an unused variable. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> (cherry picked from commit c6a07cacd3f99bb2d1fb1e77fe7724584b89ea32)
The array test was always true, so the original code always copied the name. The emptiness check introduced with the -Waddress cleanup changed that behaviour; drop the condition instead. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> (cherry picked from commit ea8d0dc54494a9c1cf1792376a1a6a828ac1f335)
The NDK now defines the ILBM chunk IDs, so guard ours with #ifndef. Exit() is not declared noreturn, so tell the compiler in each libinit.c copy that exit() does not return; the about and read modules also cast their const module_info when returning it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> (cherry picked from commit b36e4d51af7457b0f62949762cd5bf29ba5aad1e)
Pass the warning flags to the linker too, since LTO generates code at link time; without this, warnings found during link-time code generation are not reported. Build with -fno-strict-aliasing because the code base casts between Exec list structures. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> (cherry picked from commit c8a55b016f523f434e4c997a816385cd7871f992)
- Remove unused variables; mark newobject UNUSED, since only disabled code uses it. - Cast do_ToolTypes to and from the NDK's STRPTR *. - Don't redefine AFF_68060 when the NDK provides it, and brace the nested CPU detection ifs (same binding as before). - Cast ctype arguments to unsigned char. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> (cherry picked from commit 33c3e76ae30732a341902723038ddaf2b0726d5a)
- Brace flat initializer tables and TagItem arrays. - Make the update callbacks take void * like their declared hook type. - Make stpblk() take a const pointer, and set the address book window size in ftp_win instead of writing through newwin.dims. - Check AmFTP profile strings for emptiness instead of comparing their address to NULL; the site entry is cleared, so skipping an empty copy is equivalent. Drop the redundant NULL test on se_name. - Remove dead variables, escape trigraphs, and add parentheses in lst_dos_err() that match the existing precedence. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> (cherry picked from commit 4ebee5783013ff5e1bf12be183b58030d73039c4)
The cherry-picked unused-variable cleanup removed it, but dospatch_fib now uses it for the dos_patch_memory pool. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
AddObjectList, AddWindowMenus, BuildMenuStrip, CalcWindowDims, SetConfigWindowLimits, Att_NewNode, WriteBuf and NewConfigWindow.dims now take const pointers, in all header flavours (including the OS4 interface and the library's own copy of NewConfigWindow in dopusbase.h) and in the library implementation and stubs. Update the configopus structures that hold pointers to the (const) window and object tables, make GET_CALLBACK cast to REF_CALLBACK, and add the missing braces/const for the about module data. strstri() now follows the strstr() convention, and eliza.c takes its prototype from dopus.h. about_message is decrypted in place, so it is no longer const. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> (cherry picked from commit 7cb524fdabab74576bf9a79bfbe36c6f500706b6)
Brace the MakeFile command table entry and the 2D arrow image data. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- function_change: cast isspace() arguments to unsigned char. - backdrop_replace: cast do_ToolTypes to STRPTR *. - ftp: guard the non-Amiga-only SFTP socket helpers and timing variables, cast the send() buffer, make get()'s remote path const, fix misleading indentation and drop an unused variable. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The const-correctness change made image_data.imagedata const, but the AROS build byte-swaps the image words in place, which broke all AROS builds. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6e7df4f to
9f711f5
Compare
|
🤖 This comment was generated by Claude Code and reviewed by @steen-lund. Done, rebased onto
A clean OS3 build with GCC 16 has the same warnings as before. CI on my fork is green on all platforms, and compared with master's run for |
|
Thanks! |
Resolves #228
Summary
This fixes the compiler warnings that GCC 16 reports across the program,
dopus5.libraryand the modules. None of these changes is meant to change behaviour. I left out the fixes that do change behaviour, so they can be reviewed separately.What's fixed
-Wmissing-braces): command tables, Eliza string tables, TagItem arrays, flat initializer tables, 2D arrow image data-Wunused-variable,-Wunused-but-set-variable): dead variables removed or markedUNUSED, and the non-Amiga-only SFTP helpers and timing variables guardedconstqualifier (-Wdiscarded-qualifiers): thedopus5.libraryAPI made const-correct, plus theget()remote path, module data andmodule_info-Wincompatible-pointer-types): FTP update callbacks,ToolTypes,stpblk-Wchar-subscripts):isspace()and similar calls cast tounsigned char-Wmisleading-indentation): the ftp module, plus the nestedifs in the CPU detection braced (-Wdangling-else)-Wtrigraphs): ftp debug outputID_*ILBM chunk IDs andAFF_68060are guarded with#ifndef, because the NDK defines themnoreturn:exit()is marked as not returning in eachlibinit.c-Waddress): only where the fix doesn't change behaviour (AmFTP profile strings, FTP site name, filetype name copy)Things to review
AddObjectList(),AddWindowMenus(),BuildMenuStrip(),SetConfigWindowLimits(),Att_NewNode(),WriteBuf()andNewConfigWindow.dimsnow take const pointers. This applies to every header flavour, including the OS4 interface, and to the OS4, MorphOS and AROS stubs. The library vectors and registers don't change, but it is a source change for module code: modules that wrote the window size throughnewwin.dims->...must set it in their ownConfigWindowinstead, as the ftp module now does. The ChangeLog says so. Theaboutmodule keeps its image data writable, because the AROS build byte-swaps it in place.-fno-strict-aliasing, because it casts between Exec list structures throughout.make os3 cleanbefore building. Old objects that still use the previousGUI_Gluelayout cause an LTO type-mismatch warning.Not included
GCC also flags some code where fixing the warning changes what the code does:
encrypt()precedence)Testing
Clean OS3 build (
make os3 clean && make os3 all) with m68k-amigaos-gcc 16.2.0b: no errors. The remaining warnings are:-Waddress, 1-Wparentheses) whose fixes would change behaviour#warningremindersconfig_open.c,XADopus.c)make -C source/Modules/ftp -f makefile.tests testpasses.make -C source/Modules/ftp -f makefile.tests test-libssh2passes.The full CI matrix passes on my fork. I compared its warnings with the master CI run for
ba7da680, and no platform has a warning that master doesn't. One MorphOS-Wpointer-signwarning atconfig_environment.c:130only changes its text fromchar *toconst char *. Becauseeliza.cnow includesdopus.h(for the sharedstrstri()prototype), the existing AROS/MorphOS header warnings aboutID_PFS2_DISK,ID_PFS3_DISKandSimpleRequestTagsbeing redefined appear once more. Warning counts:The counts leave out
#warningdirectives and lto-wrapper notes. The other platforms still have a lot of warnings; this PR covers what GCC 16 reports on OS3.Housekeeping
[dopus5 next]entry. The version bump is deferred, following the recent entries.DOpus5.guidedoesn't need changes, because nothing user-visible changes.🤖 Generated with Claude Code