From debbugs-submit-bounces@debbugs.gnu.org Sat May 17 02:12:44 2025 Received: (at submit) by debbugs.gnu.org; 17 May 2025 06:12:44 +0000 Received: from localhost ([127.0.0.1]:44429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uGAmp-0001fb-So for submit@debbugs.gnu.org; Sat, 17 May 2025 02:12:44 -0400 Received: from lists.gnu.org ([2001:470:142::17]:56672) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uGAmm-0001fE-Js for submit@debbugs.gnu.org; Sat, 17 May 2025 02:12:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uGAmg-0003gQ-2L for bug-guile@gnu.org; Sat, 17 May 2025 02:12:34 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uGAmd-0003Nw-QX for bug-guile@gnu.org; Sat, 17 May 2025 02:12:33 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-7390d21bb1cso2722591b3a.2 for ; Fri, 16 May 2025 23:12:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747462350; x=1748067150; darn=gnu.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=c722EYqCclmz80pXjQNzBicer21IBoTlLy+EuY5tvzk=; b=U5o8qg+S0ZAsAKc9JnYMyAENKEJOA65REwO7B1JyeIu8faZQkr5cOnY2Pyj000F7Is 9dX53T87ZbcikOEDyQ6PLhKWO+jrJSZFeh+5/n/xx2GcqHNppqRy6VgdZPyNnLjo7LIq rsyvey08U3X1XZ2csFXnSSS9QYIzkHHgkyOzyvTzTxz84UvgbABlnWGYVNYE072WKHkT 4CnHM3POoLgvuyJSiBALTZmIiULssecqCndY8SAxA+qAbSSVyYdCNPb+lYS3VIzt4cfq uYFNEtGB+5zrMfhB3o+JJ7NWSIRPGF/FhBwXangLfsbE0hborCyj5282lW/HAFZ1Emc2 LM9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747462350; x=1748067150; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=c722EYqCclmz80pXjQNzBicer21IBoTlLy+EuY5tvzk=; b=YY3gOqTCyCJgL0mkIwaQa1Zt1Q/EmT51OB+4xivBdLlOJj7juSvsIEqpffTOWHfW8r vj8f1yFPw5fw8C2Inc+yhmghWcdVxSZZKRncQSap+gAdjxnFCwBT8HmDkQjF+rDaedwT AFwKxXl74RQJRmYGv7xxFp5tfoNnx+uWx7yV/zxXkgEQLPkyLEn0Z6UeSCthie0/sXmv EQzJ6YCPxTkUtVWgai2uxD/Sr8O8gI6rrHakpk/VqH2/UZUBndOA2MpVyy4RbqSUaSbP HwXrEpNI5UzvXYrSG/16Bsi96FFQDuwWu+nS4rPfZ5XuwNltnZL4BvOVZ1RKk9Tj5zx0 IxTA== X-Gm-Message-State: AOJu0Yypp9gOLa1JvB6zerSukAEKCyz9npUK418zfTnbOiqUsJxT6gGU 6HXV2HaAZ9x+xFvl47jXrGfF5SivQBO1vpiIgjYO7OYGuQb032+C/yOVYheyRA== X-Gm-Gg: ASbGncv/ZP/BagL8mbSG5MTgN6j9Hlz092rhsXj9tgr4c+daltbBaksrZ9pdCg+bjKj zk8kdZHy7sZEqabWKx860vDbDZgAHdfMa5TXAw8nzm/KBQA1olWnZZl6BnpV0MPMiLxA+j+YU8H rm0oEzh8APBDpj63UMt9Rysv+mhJk2Xu7o2v1BRqJqHAM3htFnaLd5ltvAr+VtV+07xfsf1Up68 CIbXcBWKTt3KsW+6JLiChUorllIadhcNR87XazMdla1BF4uBjqfcBfU/aOTn1J876n3sPr8gpA5 GFUh1EkC4alVFHF1P+ekGg7d8k9Q1VMSB6NvWTJ1xrM6ZTcByOpC7pDZMJdD36p508QS+gItwDs EsyACxP4m7A== X-Google-Smtp-Source: AGHT+IFraq3SMclMDKEbWF6NS6MwHTZ43l9gLF8280TSbEngC+JHTVcLnl3yO9pw0pnbh/Wg6VkRRw== X-Received: by 2002:a05:6a21:69b:b0:1f5:7c6f:6c8a with SMTP id adf61e73a8af0-216219f8d9dmr9563470637.35.1747462349782; Fri, 16 May 2025 23:12:29 -0700 (PDT) Received: from fedora (static-23-234-94-191.cust.tzulo.com. [23.234.94.191]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-30e3340187dsm6195921a91.5.2025.05.16.23.12.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 May 2025 23:12:28 -0700 (PDT) From: Collin Funk To: bug-guile@gnu.org Subject: Guile fails to build with GCC 15 Date: Fri, 16 May 2025 23:12:27 -0700 Message-ID: <875xhzix4k.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=collin.funk1@gmail.com; helo=mail-pf1-x430.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: GCC 15 defaults to '-std=gnu23' which leads to Guile failing to build after running './configure && make'. This is because C23 made: int foo (); equal to: Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (collin.funk1[at]gmail.com) 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (collin.funk1[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain GCC 15 defaults to '-std=gnu23' which leads to Guile failing to build after running './configure && make'. This is because C23 made: int foo (); equal to: int foo (void); Unlike previous C standards where it was just a function with unspecified arguments. I have attached a patch that fixes this. Collin --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-build-with-C23-compilers.patch >From ea57c7f79f92e2be7a179464ae7f45e1e130a075 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Fri, 16 May 2025 22:51:57 -0700 Subject: [PATCH] Fix build with C23 compilers. * libguile/scm.h (scm_t_subr): Always define to void pointer. Update commentary to account for C23. * libguile/lightening/lightening.h (jit_function_pointer_t): Define to a void pointer. * libguile/init.c (scm_boot_guile): Add prototype to main_func. * libguile/hash.c (floor): Add function prototype. * libguile/posix.c (scm_getpgrp): Just call the system definition directly. * libguile/array-map.c (scm_ramapc): Cast the function pointer with the correct number of arguments. * libguile/gsubr.c (scm_apply_subr): Likewise. (scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic) scm_c_define_gsubr_with_generic): Use scm_t_subr for the fcn argument which matches the declarations in libguile/gsubr.h. * libguile/fluids.c (scm_c_with_fluids, scm_with_fluid): Add function prototype to cproc. * libguile/smob.c (apply_0, apply_1, apply_2, apply_3): Cast the function with the correct number of arguments. (scm_set_smob_apply): Use scm_t_subr for the apply argument which patches libguile/smob.h. --- libguile/array-map.c | 5 ++-- libguile/fluids.c | 4 +-- libguile/gsubr.c | 51 +++++++++++++++++++------------- libguile/hash.c | 2 +- libguile/init.c | 3 +- libguile/lightening/lightening.h | 2 +- libguile/posix.c | 4 +-- libguile/scm.h | 10 ++----- libguile/smob.c | 10 +++---- 9 files changed, 47 insertions(+), 44 deletions(-) diff --git a/libguile/array-map.c b/libguile/array-map.c index ce0f7ba09..db0efd791 100644 --- a/libguile/array-map.c +++ b/libguile/array-map.c @@ -101,7 +101,6 @@ cindk (SCM ra, ssize_t *ve, int kend) int scm_ramapc (void *cproc_ptr, SCM data, SCM ra0, SCM lra, const char *what) { - int (*cproc) () = cproc_ptr; SCM z, va0, lva, *plva; int k, kmax, kroll; ssize_t *vi, inc; @@ -197,7 +196,9 @@ scm_ramapc (void *cproc_ptr, SCM data, SCM ra0, SCM lra, const char *what) SCM_I_ARRAY_SET_BASE (va0, cindk (ra0, vi, kroll)); for (z = lva; !scm_is_null (z); z = SCM_CDR (z), y = SCM_CDR (y)) SCM_I_ARRAY_SET_BASE (SCM_CAR (z), cindk (SCM_CAR (y), vi, kroll)); - if (! (SCM_UNBNDP (data) ? cproc (va0, lva) : cproc (va0, data, lva))) + if (! (SCM_UNBNDP (data) + ? ((int (*) (SCM, SCM)) cproc_ptr) (va0, lva) + : ((int (*) (SCM, SCM, SCM)) cproc_ptr) (va0, data, lva))) return 0; --k; } diff --git a/libguile/fluids.c b/libguile/fluids.c index ebdb48fbc..f6d918a34 100644 --- a/libguile/fluids.c +++ b/libguile/fluids.c @@ -506,7 +506,7 @@ SCM_DEFINE (scm_with_fluids, "with-fluids*", 3, 0, 0, #undef FUNC_NAME SCM -scm_c_with_fluids (SCM fluids, SCM values, SCM (*cproc) (), void *cdata) +scm_c_with_fluids (SCM fluids, SCM values, SCM (*cproc) (void *), void *cdata) #define FUNC_NAME "scm_c_with_fluids" { SCM ans; @@ -544,7 +544,7 @@ scm_with_fluid (SCM fluid, SCM value, SCM thunk) } SCM -scm_c_with_fluid (SCM fluid, SCM value, SCM (*cproc) (), void *cdata) +scm_c_with_fluid (SCM fluid, SCM value, SCM (*cproc) (void *), void *cdata) #define FUNC_NAME "scm_c_with_fluid" { SCM ans; diff --git a/libguile/gsubr.c b/libguile/gsubr.c index a33cbb9c4..c3afd6f47 100644 --- a/libguile/gsubr.c +++ b/libguile/gsubr.c @@ -467,38 +467,47 @@ scm_subr_name (SCM subr) SCM scm_apply_subr (union scm_vm_stack_element *sp, uint32_t idx, ptrdiff_t nslots) { - SCM (*subr)() = subrs[idx]; + void *subr = subrs[idx]; #define ARG(i) (sp[i].as_scm) switch (nslots - 1) { case 0: - return subr (); + return ((SCM (*) (void)) subr) (); case 1: - return subr (ARG (0)); + return ((SCM (*) (SCM)) subr) (ARG (0)); case 2: - return subr (ARG (1), ARG (0)); + return ((SCM (*) (SCM, SCM)) subr) (ARG (1), ARG (0)); case 3: - return subr (ARG (2), ARG (1), ARG (0)); + return ((SCM (*) (SCM, SCM, SCM)) subr) (ARG (2), ARG (1), ARG (0)); case 4: - return subr (ARG (3), ARG (2), ARG (1), ARG (0)); + return ((SCM (*) (SCM, SCM, SCM, SCM)) subr) (ARG (3), ARG (2), ARG (1), + ARG (0)); case 5: - return subr (ARG (4), ARG (3), ARG (2), ARG (1), ARG (0)); + return ((SCM (*) (SCM, SCM, SCM, SCM, SCM)) subr) (ARG (4), ARG (3), + ARG (2), ARG (1), + ARG (0)); case 6: - return subr (ARG (5), ARG (4), ARG (3), ARG (2), ARG (1), - ARG (0)); + return ((SCM (*) (SCM, SCM, SCM, SCM, SCM, SCM)) subr) (ARG (5), ARG (4), + ARG (3), ARG (2), + ARG (1), + ARG (0)); case 7: - return subr (ARG (6), ARG (5), ARG (4), ARG (3), ARG (2), - ARG (1), ARG (0)); + return ((SCM (*) (SCM, SCM, SCM, SCM, SCM, SCM, SCM)) subr) + (ARG (6), ARG (5), ARG (4), ARG (3), ARG (2), ARG (1), ARG (0)); case 8: - return subr (ARG (7), ARG (6), ARG (5), ARG (4), ARG (3), - ARG (2), ARG (1), ARG (0)); + return ((SCM (*) (SCM, SCM, SCM, SCM, SCM, SCM, SCM, SCM)) subr) + (ARG (7), ARG (6), ARG (5), ARG (4), ARG (3), ARG (2), ARG (1), + ARG (0)); case 9: - return subr (ARG (8), ARG (7), ARG (6), ARG (5), ARG (4), - ARG (3), ARG (2), ARG (1), ARG (0)); + return ((SCM (*) (SCM, SCM, SCM, SCM, SCM, SCM, SCM, SCM, SCM)) subr) + (ARG (8), ARG (7), ARG (6), ARG (5), ARG (4), ARG (3), ARG (2), + ARG (1), ARG (0)); case 10: - return subr (ARG (9), ARG (8), ARG (7), ARG (6), ARG (5), - ARG (4), ARG (3), ARG (2), ARG (1), ARG (0)); + return + ((SCM (*) (SCM, SCM, SCM, SCM, SCM, SCM, SCM, SCM, SCM, SCM)) subr) + (ARG (9), ARG (8), ARG (7), ARG (6), ARG (5), ARG (4), ARG (3), + ARG (2), ARG (1), ARG (0)); default: abort (); /* SCM_GSUBR_MAX */ } @@ -506,13 +515,13 @@ scm_apply_subr (union scm_vm_stack_element *sp, uint32_t idx, ptrdiff_t nslots) } SCM -scm_c_make_gsubr (const char *name, int req, int opt, int rst, SCM (*fcn)()) +scm_c_make_gsubr (const char *name, int req, int opt, int rst, scm_t_subr fcn) { return create_subr (0, name, req, opt, rst, fcn, NULL); } SCM -scm_c_define_gsubr (const char *name, int req, int opt, int rst, SCM (*fcn)()) +scm_c_define_gsubr (const char *name, int req, int opt, int rst, scm_t_subr fcn) { return create_subr (1, name, req, opt, rst, fcn, NULL); } @@ -522,7 +531,7 @@ scm_c_make_gsubr_with_generic (const char *name, int req, int opt, int rst, - SCM (*fcn)(), + scm_t_subr fcn, SCM *gf) { return create_subr (0, name, req, opt, rst, fcn, gf); @@ -533,7 +542,7 @@ scm_c_define_gsubr_with_generic (const char *name, int req, int opt, int rst, - SCM (*fcn)(), + scm_t_subr fcn, SCM *gf) { return create_subr (1, name, req, opt, rst, fcn, gf); diff --git a/libguile/hash.c b/libguile/hash.c index b7ad03309..cca3dd32b 100644 --- a/libguile/hash.c +++ b/libguile/hash.c @@ -48,7 +48,7 @@ #ifndef floor -extern double floor(); +extern double floor (double); #endif diff --git a/libguile/init.c b/libguile/init.c index 3df8c5ae5..37300f59a 100644 --- a/libguile/init.c +++ b/libguile/init.c @@ -277,7 +277,8 @@ static void *invoke_main_func(void *body_data); void -scm_boot_guile (int argc, char ** argv, void (*main_func) (), void *closure) +scm_boot_guile (int argc, char ** argv, + void (*main_func) (void *, int, char **), void *closure) { void *res; struct main_func_closure c; diff --git a/libguile/lightening/lightening.h b/libguile/lightening/lightening.h index b364e18cc..ecb47152a 100644 --- a/libguile/lightening/lightening.h +++ b/libguile/lightening/lightening.h @@ -222,7 +222,7 @@ JIT_API void* jit_end(jit_state_t*, size_t*); JIT_API void jit_align(jit_state_t*, unsigned); JIT_API jit_pointer_t jit_address(jit_state_t*); -typedef void (*jit_function_pointer_t)(); +typedef void *jit_function_pointer_t; JIT_API jit_function_pointer_t jit_address_to_function_pointer(jit_pointer_t); JIT_API void jit_patch_here(jit_state_t*, jit_reloc_t); JIT_API void jit_patch_there(jit_state_t*, jit_reloc_t, jit_pointer_t); diff --git a/libguile/posix.c b/libguile/posix.c index c8bbb0f83..4fde82416 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -988,9 +988,7 @@ SCM_DEFINE (scm_getpgrp, "getpgrp", 0, 0, 0, "This is the POSIX definition, not BSD.") #define FUNC_NAME s_scm_getpgrp { - int (*fn)(); - fn = (int (*) ()) getpgrp; - return scm_from_int (fn (0)); + return scm_from_int (getpgrp ()); } #undef FUNC_NAME #endif /* HAVE_GETPGRP */ diff --git a/libguile/scm.h b/libguile/scm.h index 180b40159..de6940e04 100644 --- a/libguile/scm.h +++ b/libguile/scm.h @@ -810,15 +810,9 @@ enum scm_tc8_tags /* The type of subrs, i.e., Scheme procedures implemented in C. Empty - function declarators are used internally for pointers to functions of - any arity. However, these are equivalent to `(void)' in C++, are - obsolescent as of C99, and trigger `strict-prototypes' GCC warnings - (bug #23681). */ -#ifdef BUILDING_LIBGUILE -typedef SCM (* scm_t_subr) (); -#else + function declarators are equivelent to `(void)' in C++ and C23. + So we must use a void pointer and cast it. */ typedef void *scm_t_subr; -#endif typedef struct scm_dynamic_state scm_t_dynamic_state; typedef struct scm_print_state scm_print_state; diff --git a/libguile/smob.c b/libguile/smob.c index 8e4da9adb..4c97499fa 100644 --- a/libguile/smob.c +++ b/libguile/smob.c @@ -133,28 +133,28 @@ static SCM scm_smob_trampolines[16]; static SCM apply_0 (SCM smob) { - SCM (*subr)() = SCM_SMOB_DESCRIPTOR (smob).apply; + SCM (*subr) (SCM) = SCM_SMOB_DESCRIPTOR (smob).apply; return subr (smob); } static SCM apply_1 (SCM smob, SCM a) { - SCM (*subr)() = SCM_SMOB_DESCRIPTOR (smob).apply; + SCM (*subr) (SCM, SCM) = SCM_SMOB_DESCRIPTOR (smob).apply; return subr (smob, a); } static SCM apply_2 (SCM smob, SCM a, SCM b) { - SCM (*subr)() = SCM_SMOB_DESCRIPTOR (smob).apply; + SCM (*subr) (SCM, SCM, SCM) = SCM_SMOB_DESCRIPTOR (smob).apply; return subr (smob, a, b); } static SCM apply_3 (SCM smob, SCM a, SCM b, SCM c) { - SCM (*subr)() = SCM_SMOB_DESCRIPTOR (smob).apply; + SCM (*subr) (SCM, SCM, SCM, SCM) = SCM_SMOB_DESCRIPTOR (smob).apply; return subr (smob, a, b, c); } @@ -254,7 +254,7 @@ scm_set_smob_equalp (scm_t_bits tc, SCM (*equalp) (SCM, SCM)) } void -scm_set_smob_apply (scm_t_bits tc, SCM (*apply) (), +scm_set_smob_apply (scm_t_bits tc, scm_t_subr apply, unsigned int req, unsigned int opt, unsigned int rst) { SCM trampoline = scm_smob_trampoline (req, opt, rst); -- 2.49.0 --=-=-=--