From 98f76792f57521d58bbdb440b50fce7f4a964829 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Fri, 27 Mar 2026 15:13:22 +0100 Subject: [PATCH 1/5] Correct yylex() prototype and add early. (Silences compile warning.) --- mccode/src/instrument.y | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mccode/src/instrument.y b/mccode/src/instrument.y index 8e7cab41e3..40c8fc1fc4 100644 --- a/mccode/src/instrument.y +++ b/mccode/src/instrument.y @@ -26,6 +26,7 @@ #include #include #include +int yylex(void *yylval); #include "mccode.h" @@ -67,7 +68,7 @@ /* typedef struct List_header * List; */ /* typedef struct Symbol_table * Symtab; */ /* typedef struct instr_def * instr_ptr_t; */ -int yylex(); +int yylex(void *yylval); int yyerror(const char *s); List list_cat(List, List); Symtab symtab_cat(Symtab, Symtab); From 2a2f9cc687384980d99072f44c1b35634028656b Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Fri, 27 Mar 2026 15:15:03 +0100 Subject: [PATCH 2/5] Remove local typedefs in list.c (silences compile-time warning) --- mccode/src/list.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mccode/src/list.c b/mccode/src/list.c index 0b620bde2a..aaca0978c8 100644 --- a/mccode/src/list.c +++ b/mccode/src/list.c @@ -43,8 +43,9 @@ struct List_position int index; /* Next element to return. */ }; -typedef struct List_header *List; -typedef struct List_position *List_handle; +/* Typedefs suppressed, already defined from mccode.h */ +/* typedef struct List_header *List; + typedef struct List_position *List_handle; */ /******************************************************************************* * Create a new list. @@ -233,4 +234,5 @@ List list_copy(List from, void * (*copier)(void *)){ list_iterate_end(liter); } return to; -} \ No newline at end of file +} + From cdba96dfec0e9072e6e259759a8841f15243adb6 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Fri, 27 Mar 2026 15:16:12 +0100 Subject: [PATCH 3/5] Replace fatal_warning by fprintf(stderr...) to avoid debug.c requirement --- mccode/src/port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mccode/src/port.c b/mccode/src/port.c index 54abcb6347..46c4384d30 100644 --- a/mccode/src/port.c +++ b/mccode/src/port.c @@ -39,7 +39,7 @@ int strcasecmp(char *s1, char *s2) #ifndef HAVE_FDOPEN FILE *fdopen(int descr, const char *mode) { - fatal_error("The '-' argument for standard input and output is not supported" + fprintf(stderr, "The '-' argument for standard input and output is not supported" " on this system."); return(NULL); } From 54d4ba539196d3fbead65be212f7dad7d58fcd07 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Fri, 27 Mar 2026 15:17:21 +0100 Subject: [PATCH 4/5] Ensure __MACH__ (macOS) systems have relevant defines set --- mccode/src/port.h.in | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mccode/src/port.h.in b/mccode/src/port.h.in index 1e9596a8ea..779d319d19 100644 --- a/mccode/src/port.h.in +++ b/mccode/src/port.h.in @@ -20,13 +20,23 @@ * *******************************************************************************/ -/* Macintosh specific compiler defines. */ +/* !!OLD!! Macintosh specific compiler defines. */ #ifdef __dest_os #if (__dest_os == __mac_os) #define MAC #endif #endif +/* Modern macOS defines */ +#ifdef __MACH__ +#ifndef HAVE_STRCASECMP +#define HAVE_STRCASECMP HAVE_STRCASECMP +#endif +#ifndef HAVE_STRCASESTR +#define HAVE_STRCASESTR HAVE_STRCASESTR +#endif +#endif + /* File system details. */ #ifndef MC_PATHSEP_C #ifdef WIN32 From c364684fcd6801f1c56c7fcf3ae0822fdba4ca1e Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Fri, 27 Mar 2026 15:17:47 +0100 Subject: [PATCH 5/5] Silence compile-time warnings from code generator codes --- mccode/src/cogen.c.in | 5 +++-- mccode/src/pygen.c.in | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mccode/src/cogen.c.in b/mccode/src/cogen.c.in index 98a5e03645..bc15aa1b12 100644 --- a/mccode/src/cogen.c.in +++ b/mccode/src/cogen.c.in @@ -2306,6 +2306,7 @@ int cogen_rt_funnel(struct instr_def *instr) coutf("#endif // FUNNEL"); coutf(""); printf("\n-----------------------------------------------------------\n"); + return(warnings); } /* cogen_rt_funnel */ /******************************************************************************* @@ -2494,7 +2495,7 @@ cogen_header(struct instr_def *instr, char *output_name) cliter2 = list_iterate(ctypes); char *cvar; char *ctpe; - while(cvar = list_next(cliter)) { + while((cvar = list_next(cliter))) { ctpe = list_next(cliter2); char *Numberedvar = malloc(256*sizeof(char)); /* We need to attach comp index to cvar */ @@ -3115,7 +3116,7 @@ void detect_skipable_transforms(struct instr_def *instr) { // Its target can not be skipped either struct jump_struct *this_jump; List_handle literJ = list_iterate(comp->jump); - while (this_jump = list_next(literJ)) { + while ((this_jump = list_next(literJ))) { // Find target (not initialized yet) List_handle liter3 = list_iterate(instr->complist); diff --git a/mccode/src/pygen.c.in b/mccode/src/pygen.c.in index 568fabfee4..08bb2bf060 100644 --- a/mccode/src/pygen.c.in +++ b/mccode/src/pygen.c.in @@ -402,7 +402,7 @@ int cogen_decls(struct instr_def *instr) while ((one_component_metadata = symtab_next(component_metadata_handle))) { coutf(" '%s': {", one_component_metadata->name); liter = list_iterate(one_component_metadata->val); - while (metadataStruct = list_next(liter)) { + while ((metadataStruct = list_next(liter))) { coutf(" '%s': ('%s', ", metadataStruct->name, metadataStruct->type); triple_escaped_lines_out(metadataStruct->lines); coutf(" ), "); @@ -924,7 +924,7 @@ void detect_skipable_transforms(struct instr_def *instr) { // Its target can not be skipped either struct jump_struct *this_jump; List_handle literJ = list_iterate(comp->jump); - while (this_jump = list_next(literJ)) { + while ((this_jump = list_next(literJ))) { // Find target (not initialized yet) List_handle liter3 = list_iterate(instr->complist);