sasagawa888 / eisl

ISLisp interpreter/compiler
Other
275 stars 23 forks source link

compilation on macOS with clang 14 fails #287

Closed informatimago closed 1 year ago

informatimago commented 1 year ago
00:55[pjb@despina org.xquartz:0 eisl 52Gi]$  make PREFIX=/usr/local install
cc -Icii/include -g -Wall -Wextra -D_FORTIFY_SOURCE=2 -I/usr/include/ncurses -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -D_XOPEN_SOURCE_EXTENDED -Inana/src -O3 -flto -DNDEBUG=1 -DWITHOUT_NANA=1 -std=c17 -DSHAREDIR=/usr/local/share/eisl -c main.c -o main.o
main.c:521:21: warning: comparison of integers of different signs: 'unsigned long' and 'int' [-Wsign-compare]
    if (strlen(str) > stok.bufsize) {
        ~~~~~~~~~~~ ^ ~~~~~~~~~~~~
1 warning generated.
cc -Icii/include -g -Wall -Wextra -D_FORTIFY_SOURCE=2 -I/usr/include/ncurses -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -D_XOPEN_SOURCE_EXTENDED -Inana/src -O3 -flto -DNDEBUG=1 -DWITHOUT_NANA=1 -std=c17 -DSHAREDIR=/usr/local/share/eisl -c function.c -o function.o
function.c:4158:13: warning: variable 'str' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
    else if(isUni6(c)){
            ^~~~~~~~~
./eisl.h:74:21: note: expanded from macro 'isUni6'
#define isUni6(c)   (((unsigned char)(c) >= 0xfc) && \
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function.c:4172:10: note: uninitialized use occurs here
    FREE(str);
         ^~~
cii/include/mem.h:20:37: note: expanded from macro 'FREE'
#define FREE(ptr) ((void)(Mem_free((ptr), \
                                    ^~~
function.c:4158:10: note: remove the 'if' if its condition is always true
    else if(isUni6(c)){
         ^~~~~~~~~~~~~
function.c:4158:13: warning: variable 'str' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
    else if(isUni6(c)){
            ^~~~~~~~~
./eisl.h:74:22: note: expanded from macro 'isUni6'
#define isUni6(c)   (((unsigned char)(c) >= 0xfc) && \
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
function.c:4172:10: note: uninitialized use occurs here
    FREE(str);
         ^~~
cii/include/mem.h:20:37: note: expanded from macro 'FREE'
#define FREE(ptr) ((void)(Mem_free((ptr), \
                                    ^~~
function.c:4158:13: note: remove the '&&' if its condition is always true
    else if(isUni6(c)){
            ^
./eisl.h:74:22: note: expanded from macro 'isUni6'
#define isUni6(c)   (((unsigned char)(c) >= 0xfc) && \
                     ^
function.c:4089:14: note: initialize the variable 'str' to silence this warning
    char *str, c;
             ^
              = NULL
function.c:4409:12: warning: unused variable 'addr' [-Wunused-variable]
    int n, addr;
           ^
function.c:4401:20: warning: unused function 'SET_FLAG' [-Wunused-function]
static inline void SET_FLAG(int addr, flag x)
                   ^
4 warnings generated.
cc -Icii/include -g -Wall -Wextra -D_FORTIFY_SOURCE=2 -I/usr/include/ncurses -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -D_XOPEN_SOURCE_EXTENDED -Inana/src -O3 -flto -DNDEBUG=1 -DWITHOUT_NANA=1 -std=c17 -DSHAREDIR=/usr/local/share/eisl -c extension.c -o extension.o
extension.c:864:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
}
^
1 warning generated.
cc -Icii/include -g -Wall -Wextra -D_FORTIFY_SOURCE=2 -I/usr/include/ncurses -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -D_XOPEN_SOURCE_EXTENDED -Inana/src -O3 -flto -DNDEBUG=1 -DWITHOUT_NANA=1 -std=c17 -DSHAREDIR=/usr/local/share/eisl -c syntax.c -o syntax.o
syntax.c:1107:21: warning: unused variable 'i' [-Wunused-variable]
    int arg1, arg2, i, tag, ret, res, save, unwind;
                    ^
syntax.c:1186:14: error: implicit declaration of function 'find_tag' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    if ((i = find_tag(tag)) == FAILSE)
             ^
1 warning and 1 error generated.
make: *** [syntax.o] Error 1

~/src/others/sasagawa888/eisl
00:55[pjb@despina org.xquartz:0 eisl 52Gi]$ clang --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

~/src/others/sasagawa888/eisl
00:55[pjb@despina org.xquartz:0 eisl 52Gi]$ git info
== Remote URLs:
origin  git@github.com:sasagawa888/eisl.git (fetch)
origin  git@github.com:sasagawa888/eisl.git (push)

== Remote Branches:
  origin/HEAD -> origin/master
  origin/master
  origin/origin/master

== Local Branches:
* master

== Configuration (.git/config)
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    precomposeunicode = true
[remote "origin"]
    url = git@github.com:sasagawa888/eisl.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

== Most Recent Commit:
commit c0ff5e2c85a271225305d8fa5f0561039cfbed80 (HEAD -> master, tag: v3.00, origin/master, origin/HEAD)
Author: sasagawa888 <ken-s@tkcnf.or.jp>
Date:   Fri Jun 16 07:37:11 2023 +0900

    Add example collatz problem

~/src/others/sasagawa888/eisl
00:55[pjb@despina org.xquartz:0 eisl 52Gi]$
informatimago commented 1 year ago

0001-Corrected-compilation-errors-and-warning-with-clang-.patch

sasagawa888 commented 1 year ago

Thank you. It would be helpful if you could submit a pull request.

informatimago commented 1 year ago

Will do.