kfl / mosml

Moscow ML is a light-weight implementation of Standard ML (SML), a strict functional language widely used in teaching and research.
http://mosml.org
341 stars 42 forks source link

Build error with clang: mgd.c: error: call to undeclared function 'failwith', etc. #71

Open barracuda156 opened 1 year ago

barracuda156 commented 1 year ago
  make[1]: Entering directory `/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_lang_mosml/mosml-dynlibs/work/mosml-13c581aec46eea134e478f2e2b6456278e36ecce/src/dynlibs/mgd'
  /opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_lang_mosml/mosml-dynlibs/work/compwrap/cc/usr/bin/clang -Dunix -O2 -fno-defer-pop -fPIC -I/opt/local/include/mosml -I/opt/local/include -c -o mgd.o mgd.c
  clang: warning: optimization flag '-fno-defer-pop' is not supported [-Wignored-optimization-argument]
  mgd.c:82:5: error: call to undeclared function 'failwith'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      failwith("Could not create image");
      ^
  mgd.c:96:5: error: call to undeclared function 'failwith'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      failwith("Cannot open PNG file for input");
      ^
  mgd.c:112:5: error: call to undeclared function 'failwith'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      failwith("Cannot open PNG file for output");
      ^
  mgd.c:127:3: error: call to undeclared function 'flush'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    flush(stdout);
    ^
  mgd.c:127:3: note: did you mean 'fflush'?
  /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/stdio.h:146:6: note: 'fflush' declared here
  int      fflush(FILE *);
           ^
  mgd.c:167:3: error: call to undeclared function 'modify'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    modify(&Field(res, 0), Val_long(color));
    ^
  mgd.c:184:10: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
  { return Val_long(gdTransparent); }
           ^~~~~~~~~~~~~~~~~~~~~~~
  /opt/local/include/mosml/mlvalues.h:63:37: note: expanded from macro 'Val_long'
  #define Val_long(x)     (((long)(x) << 1) + 1)
                            ~~~~~~~~~ ^
  mgd.c:189:10: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
  { return Val_long(gdBrushed); }
           ^~~~~~~~~~~~~~~~~~~
barracuda156 commented 1 year ago
make[1]: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mosml/mosml-dynlibs/work/mosml-13c581aec46eea134e478f2e2b6456278e36ecce/src/dynlibs/mmysql'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mosml/mosml-dynlibs/work/compwrap/cc/opt/local/bin/gcc-mp-12 -Dunix -O2 -fno-defer-pop -I/opt/local/include/mosml -I /opt/local/include/mysql57/mysql -c -o mmysql.o mmysql.c
mmysql.c: In function 'dbresult_finalize':
mmysql.c:79:28: error: lvalue required as left operand of assignment
   79 |     DBresult_val(dbresval) = NULL;
      |                            ^
mmysql.c:81:33: error: lvalue required as left operand of assignment
   81 |     DBresultindex_val(dbresval) = NULL;
      |                                 ^

This one has been reported much earlier, but looks like still unfixed: https://trac.macports.org/ticket/39664