Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clang compilation errors and warnings #492

Open
dvorka opened this issue Apr 24, 2023 · 0 comments
Open

Fix clang compilation errors and warnings #492

dvorka opened this issue Apr 24, 2023 · 0 comments
Assignees

Comments

@dvorka
Copy link
Owner

dvorka commented Apr 24, 2023

Compiler log:

➜  hstr git:(dev-3.2.0) make clean all
rm -f hashset.o hstr_blacklist.o hstr_curses.o hstr_favorites.o hstr_history.o hstr_regexp.o hstr_utils.o hstr.o radixsort.o main.o
rm -f *~ core *.core
ccache gcc -c -pipe -O2  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DDEBUG_NO_TIOCSTI -I. -I../../../../Qt/5.9.9/clang_64/mkspecs/macx-clang -o hashset.o src/hashset.c
ccache gcc -c -pipe -O2  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DDEBUG_NO_TIOCSTI -I. -I../../../../Qt/5.9.9/clang_64/mkspecs/macx-clang -o hstr_blacklist.o src/hstr_blacklist.c
ccache gcc -c -pipe -O2  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DDEBUG_NO_TIOCSTI -I. -I../../../../Qt/5.9.9/clang_64/mkspecs/macx-clang -o hstr_curses.o src/hstr_curses.c
ccache gcc -c -pipe -O2  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DDEBUG_NO_TIOCSTI -I. -I../../../../Qt/5.9.9/clang_64/mkspecs/macx-clang -o hstr_favorites.o src/hstr_favorites.c
ccache gcc -c -pipe -O2  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DDEBUG_NO_TIOCSTI -I. -I../../../../Qt/5.9.9/clang_64/mkspecs/macx-clang -o hstr_history.o src/hstr_history.c
src/hstr_history.c:175:52: error: no member named 'size' in 'HISTORY_STATE'
        unsigned radixMaxKeyEstimate=historyState->size*1000;
                                     ~~~~~~~~~~~~  ^
src/hstr_history.c:181:34: error: implicit declaration of function 'history_list' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        HIST_ENTRY **historyList=history_list();
                                 ^
src/hstr_history.c:181:34: note: did you mean 'history_get'?
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/readline/history.h:153:13: note: 'history_get' declared here
HIST_ENTRY      *history_get(int);
                 ^
src/hstr_history.c:181:22: warning: incompatible integer to pointer conversion initializing 'HIST_ENTRY **' (aka 'struct _hist_entry **') with an expression of type 'int' [-Wint-conversion]
        HIST_ENTRY **historyList=history_list();
                     ^           ~~~~~~~~~~~~~~
src/hstr_history.c:197:37: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
            line=parse_history_line(historyList[i]->line);
                                    ^~~~~~~~~~~~~~~~~~~~
src/hstr_history.c:102:32: note: passing argument to parameter 'l' here
char* parse_history_line(char *l)
                               ^
src/hstr_history.c:318:25: error: no member named 'entries' in 'HISTORY_STATE'
        l=historyState->entries[offset]->line;
          ~~~~~~~~~~~~  ^
src/hstr_history.c:325:16: error: implicit declaration of function 'free_history_entry' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
               free_history_entry(remove_history(offset));
               ^
src/hstr_history.c:325:16: note: did you mean 'replace_history_entry'?
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/readline/history.h:155:13: note: 'replace_history_entry' declared here
HIST_ENTRY      *replace_history_entry(int, const char *, histdata_t);
                 ^
src/hstr_history.c:327:36: error: no member named 'entries' in 'HISTORY_STATE'
                   l=historyState->entries[offset-1]->line;
                     ~~~~~~~~~~~~  ^
src/hstr_history.c:358:83: error: no member named 'entries' in 'HISTORY_STATE'
            fprintf(stdout, "Deleting command '%s' from history\n", historyState->entries[historyState->length-2]->line);
                                                                    ~~~~~~~~~~~~  ^
src/hstr_history.c:360:9: error: implicit declaration of function 'free_history_entry' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        free_history_entry(remove_history(historyState->length-1));
        ^
2 warnings and 7 errors generated.
make: *** [hstr_history.o] Error 1
@dvorka dvorka added this to the 3.2 Stabilization milestone Apr 24, 2023
@dvorka dvorka self-assigned this Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant