URL:
  <https://savannah.gnu.org/patch/?10638>

                 Summary: [PATCH] inconsistent declarations
                   Group: MIT/GNU Scheme
               Submitter: barak
               Submitted: Thu 01 Oct 2026 10:04:47 AM UTC
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Unlocked


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Thu 01 Oct 2026 10:04:47 AM UTC By: Barak A. Pearlmutter <barak>
An LTO compile (link-time global optimization of C code) reveals three
inconsistent declarations, meaning an inconsistency between distinct
translation units. Two of these are fatal, the other just a warning,
due to compiler options in effect at the time.

  tterm.c:72:15: error: type of 'tparam' does not match original
                 declaration [-Werror=lto-type-mismatch]
  sysprim.c:37:13: error: type of 'OS_set_trap_state' does not match
                   original declaration [-Werror=lto-type-mismatch]
  x11-shim.h:159:13: warning: type of 'x_store_colors' does not match
                     original declaration [-Wlto-type-mismatch]

Details:

tterm.c declared tparam as (const char *, void *, int, ...), which is
GNU termcap's signature, but the tparam actually linked is from
terminfo.c, which takes twelve fixed parameters and forwards nine to
tparm. (Note that ncurses does not export a tparam of its own.) The
call passed seven arguments, so five of tparm's nine were whatever
happened to be in the argument registers. Fix by declaring it as
defined and pass zeros.

sysprim.c declared OS_set_trap_state as (long) returning long;
uxtrap.c and nttrap.c define it over enum trap_state. The correct
prototype was already in uxtrap.h and nttrap.h, which sysprim.c cannot
include, being portable: hence the hand-written one. Fix by moving the
enum and the prototype to ostop.h, which is portable, already contains
the other OS_ entry points, and is already #included by sysprim.c. The
two platform headers will get the declaration from there.

x11color.c defined x_store_colors over (unsigned int *, unsigned int)
where x11.cdecl, and thus the generated x11-shim.h, read (* int) and
ulong. The plugins are not built with -Werror so this only generated a
warning, but the caller passes a 64-bit count and callee expects a
32-bit count. Fix by matching the definition to the declared
interface, keeping the pixel value zero-extended.






    _______________________________________________________
File Attachments:

Name: 0001-inconsistent-declarations.patch Size: 6.3KiB

<https://file.savannah.gnu.org/file/0001-inconsistent-declarations.patch?file_id=59050>



    AGPL NOTICE

These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-115117bf8159ea7e8986b9796f840ecf327addf3.tar.gz

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?10638>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to