History

Minor fixes for gnu90 compatibility

Sushant Pandurangi committed 5 years ago

Commit d5e4b251 parent 33fa3a43 files · +15 −13Browse files

Unified · Split

3 files
  1. libtcc.c +3 −2
  2. tcc.h +1 −1
  3. tccmacho.c +11 −10
libtcc.c+3−2
@@ -1033,12 +1033,13 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags) · 1032 unmodified lines
10331033 case AFF_BINTYPE_DYN:
10341034 if (s1->output_type == TCC_OUTPUT_MEMORY) {
10351035 #ifdef TCC_IS_NATIVE
1036− char* soname = filename;
1036+ void* dl;
1037+ const char* soname = filename;
10371038 # ifdef TCC_TARGET_MACHO
10381039 if (!strcmp(tcc_fileextension(filename), ".tbd"))
10391040 soname = macho_tbd_soname(filename);
10401041 # endif
1041− void* dl = dlopen(soname, RTLD_GLOBAL | RTLD_LAZY);
1042+ dl = dlopen(soname, RTLD_GLOBAL | RTLD_LAZY);
10421043 if (dl) {
10431044 tcc_add_dllref(s1, soname)->handle = dl;
10441045 ret = 0;
tcc.h+1−1
@@ -247,7 +247,7 @@ extern long double strtold (const char *__nptr, char **__endptr); · 246 unmodified lines
247247 # define ALSO_TRIPLET(s) s
248248 #endif
249249
250−// FIXME: do this at runtime instead; check output of `xcode-select -p`. libxcselect provides this stuff
250+/* FIXME: do this at runtime instead; check output of `xcode-select -p`. libxcselect provides this stuff */
251251 #ifndef CONFIG_OSX_SDK1
252252 # define CONFIG_OSX_SDK1 "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
253253 # define CONFIG_OSX_SDK2 "/Applications/Xcode.app/Developer/SDKs/MacOSX.sdk"
tccmacho.c+11−10
@@ -841,7 +841,8 @@ ST_FUNC int macho_add_dllref(TCCState* s1, int lev, const char* soname) · 840 unmodified lines
841841 {
842842 /* if the dll is already loaded, do not load it */
843843 DLLReference *dllref;
844− for(int i = 0; i < s1->nb_loaded_dlls; i++) {
844+ int i;
845+ for(i = 0; i < s1->nb_loaded_dlls; i++) {
845846 dllref = s1->loaded_dlls[i];
846847 if (!strcmp(soname, dllref->name)) {
847848 /* but update level if needed */
@@ -866,14 +867,14 @@ ST_FUNC int macho_add_dllref(TCCState* s1, int lev, const char* soname) · 18 unmodified lines
866867 #define tbd_parse_trample *pos++=0
867868
868869 ST_FUNC const char* macho_tbd_soname(const char* filename) {
869− char* soname;
870+ char *soname, *data, *pos, *ret;
871+ struct stat sb;
870872 int fd = open(filename,O_RDONLY);
871873 if (fd<0) return filename;
872− struct stat sb;
873874 fstat(fd,&sb);
874− char* data = load_data(fd, 0, sb.st_size+1);
875+ data = load_data(fd, 0, sb.st_size+1);
875876 data[sb.st_size]=0;
876− char* pos = data;
877+ pos = data;
877878
878879 if (!tbd_parse_movepast("install-name: ")) return filename;
879880 tbd_parse_skipws;
@@ -881,7 +882,7 @@ ST_FUNC const char* macho_tbd_soname(const char* filename) { · 1 unmodified line
881882 soname = pos;
882883 if (!tbd_parse_movetoany("\n \"'")) return filename;
883884 tbd_parse_trample;
884− char* ret = tcc_mallocz(strlen(soname)+1);
885+ ret = tcc_mallocz(strlen(soname)+1);
885886 strcpy(ret, soname);
886887 // soname = strdup(soname);
887888 tcc_free(data);
@@ -890,13 +891,13 @@ ST_FUNC const char* macho_tbd_soname(const char* filename) { · 2 unmodified lines
890891
891892 ST_FUNC int macho_load_tbd(TCCState* s1, int fd, const char* filename, int lev)
892893 {
893− char* soname;
894+ char *soname, *data, *pos;
894895
895896 struct stat sb;
896897 fstat(fd,&sb);
897− char* data = load_data(fd, 0, sb.st_size+1);
898+ data = load_data(fd, 0, sb.st_size+1);
898899 data[sb.st_size]=0;
899− char* pos = data;
900+ pos = data;
900901
901902 if (!tbd_parse_movepast("install-name: ")) return -1;
902903 tbd_parse_skipws;
@@ -908,9 +909,9 @@ ST_FUNC int macho_load_tbd(TCCState* s1, int fd, const char* filename, int lev) · 5 unmodified lines
908909
909910 while(pos) {
910911 char* sym = NULL;
912+ int cont = 1;
911913 if (!tbd_parse_movepast("symbols: ")) break;
912914 if (!tbd_parse_movepast("[")) break;
913− int cont = 1;
914915 while (cont) {
915916 tbd_parse_skipws;
916917 tbd_parse_tramplequote;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t