Skip to content

Commit 451df4f

Browse files
authored
Merge pull request #2374 from mccode-dev/Remove-cogen-compiletime-warnings
Remove cogen compiletime warnings
2 parents 5f09ab7 + c364684 commit 451df4f

6 files changed

Lines changed: 24 additions & 10 deletions

File tree

mccode/src/cogen.c.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,6 +2306,7 @@ int cogen_rt_funnel(struct instr_def *instr)
23062306
coutf("#endif // FUNNEL");
23072307
coutf("");
23082308
printf("\n-----------------------------------------------------------\n");
2309+
return(warnings);
23092310
} /* cogen_rt_funnel */
23102311

23112312
/*******************************************************************************
@@ -2494,7 +2495,7 @@ cogen_header(struct instr_def *instr, char *output_name)
24942495
cliter2 = list_iterate(ctypes);
24952496
char *cvar;
24962497
char *ctpe;
2497-
while(cvar = list_next(cliter)) {
2498+
while((cvar = list_next(cliter))) {
24982499
ctpe = list_next(cliter2);
24992500
char *Numberedvar = malloc(256*sizeof(char));
25002501
/* We need to attach comp index to cvar */
@@ -3115,7 +3116,7 @@ void detect_skipable_transforms(struct instr_def *instr) {
31153116
// Its target can not be skipped either
31163117
struct jump_struct *this_jump;
31173118
List_handle literJ = list_iterate(comp->jump);
3118-
while (this_jump = list_next(literJ)) {
3119+
while ((this_jump = list_next(literJ))) {
31193120

31203121
// Find target (not initialized yet)
31213122
List_handle liter3 = list_iterate(instr->complist);

mccode/src/instrument.y

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <math.h>
2727
#include <string.h>
2828
#include <stdio.h>
29+
int yylex(void *yylval);
2930

3031
#include "mccode.h"
3132

@@ -67,7 +68,7 @@
6768
/* typedef struct List_header * List; */
6869
/* typedef struct Symbol_table * Symtab; */
6970
/* typedef struct instr_def * instr_ptr_t; */
70-
int yylex();
71+
int yylex(void *yylval);
7172
int yyerror(const char *s);
7273
List list_cat(List, List);
7374
Symtab symtab_cat(Symtab, Symtab);

mccode/src/list.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ struct List_position
4343
int index; /* Next element to return. */
4444
};
4545

46-
typedef struct List_header *List;
47-
typedef struct List_position *List_handle;
46+
/* Typedefs suppressed, already defined from mccode.h */
47+
/* typedef struct List_header *List;
48+
typedef struct List_position *List_handle; */
4849

4950
/*******************************************************************************
5051
* Create a new list.
@@ -233,4 +234,5 @@ List list_copy(List from, void * (*copier)(void *)){
233234
list_iterate_end(liter);
234235
}
235236
return to;
236-
}
237+
}
238+

mccode/src/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ int strcasecmp(char *s1, char *s2)
3939
#ifndef HAVE_FDOPEN
4040
FILE *fdopen(int descr, const char *mode)
4141
{
42-
fatal_error("The '-' argument for standard input and output is not supported"
42+
fprintf(stderr, "The '-' argument for standard input and output is not supported"
4343
" on this system.");
4444
return(NULL);
4545
}

mccode/src/port.h.in

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,23 @@
2020
*
2121
*******************************************************************************/
2222

23-
/* Macintosh specific compiler defines. */
23+
/* !!OLD!! Macintosh specific compiler defines. */
2424
#ifdef __dest_os
2525
#if (__dest_os == __mac_os)
2626
#define MAC
2727
#endif
2828
#endif
2929

30+
/* Modern macOS defines */
31+
#ifdef __MACH__
32+
#ifndef HAVE_STRCASECMP
33+
#define HAVE_STRCASECMP HAVE_STRCASECMP
34+
#endif
35+
#ifndef HAVE_STRCASESTR
36+
#define HAVE_STRCASESTR HAVE_STRCASESTR
37+
#endif
38+
#endif
39+
3040
/* File system details. */
3141
#ifndef MC_PATHSEP_C
3242
#ifdef WIN32

mccode/src/pygen.c.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ int cogen_decls(struct instr_def *instr)
402402
while ((one_component_metadata = symtab_next(component_metadata_handle))) {
403403
coutf(" '%s': {", one_component_metadata->name);
404404
liter = list_iterate(one_component_metadata->val);
405-
while (metadataStruct = list_next(liter)) {
405+
while ((metadataStruct = list_next(liter))) {
406406
coutf(" '%s': ('%s', ", metadataStruct->name, metadataStruct->type);
407407
triple_escaped_lines_out(metadataStruct->lines);
408408
coutf(" ), ");
@@ -924,7 +924,7 @@ void detect_skipable_transforms(struct instr_def *instr) {
924924
// Its target can not be skipped either
925925
struct jump_struct *this_jump;
926926
List_handle literJ = list_iterate(comp->jump);
927-
while (this_jump = list_next(literJ)) {
927+
while ((this_jump = list_next(literJ))) {
928928

929929
// Find target (not initialized yet)
930930
List_handle liter3 = list_iterate(instr->complist);

0 commit comments

Comments
 (0)