Unified · Split
| @@ -154,7 +154,7 @@ macro(make_tcc native_name cross_name cross_enabled definitions tcc_sources libt · 153 unmodified lines | ||
| 154 | 154 | foreach(make_tcc_def ${TCC_NATIVE_DEFINITIONS}) |
| 155 | 155 | set(TCC_NATIVE_FLAGS ${TCC_NATIVE_FLAGS} -D${make_tcc_def}) |
| 156 | 156 | endforeach() |
| 157 | − | |
| 157 | + | |
| 158 | 158 | if (TCC_BUILD_NATIVE) |
| 159 | 159 | add_library(libtcc |
| 160 | 160 | libtcc.c |
| @@ -179,7 +179,7 @@ macro(make_tcc native_name cross_name cross_enabled definitions tcc_sources libt · 18 unmodified lines | ||
| 179 | 179 | endif() |
| 180 | 180 | install(TARGETS tcc libtcc RUNTIME DESTINATION ${EXE_PATH} LIBRARY DESTINATION ${NATIVE_LIB_PATH} ARCHIVE DESTINATION ${NATIVE_LIB_PATH}) |
| 181 | 181 | set_target_properties(tcc libtcc PROPERTIES COMPILE_DEFINITIONS "${TCC_NATIVE_DEFINITIONS}") |
| 182 | − | |
| 182 | + | |
| 183 | 183 | if("${libtcc_sources}" STRGREATER "") |
| 184 | 184 | make_libtcc1("" tcc "${libtcc_ar}" "${TCC_NATIVE_DEFINITIONS}" "${libtcc_includes}" "${libtcc_sources}") |
| 185 | 185 | endif() |
| @@ -188,7 +188,7 @@ macro(make_tcc native_name cross_name cross_enabled definitions tcc_sources libt · 2 unmodified lines | ||
| 188 | 188 | add_executable(${cross_name}-tcc tcc.c) |
| 189 | 189 | set_target_properties(${cross_name}-tcc PROPERTIES COMPILE_DEFINITIONS "ONE_SOURCE;${definitions}") |
| 190 | 190 | install(TARGETS ${cross_name}-tcc RUNTIME DESTINATION ${EXE_PATH}) |
| 191 | − | |
| 191 | + | |
| 192 | 192 | if("${libtcc_sources}" STRGREATER "") |
| 193 | 193 | make_libtcc1(${cross_name} "${cross_name}-tcc" "${libtcc_ar}" "${definitions}" "${libtcc_includes}" "${libtcc_sources}") |
| 194 | 194 | endif() |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * TMS320C67xx code generator for TCC |
| 3 | − * | |
| 3 | + * | |
| 4 | 4 | * Copyright (c) 2001, 2002 Fabrice Bellard |
| 5 | 5 | * |
| 6 | 6 | * This library is free software; you can redistribute it and/or |
| @@ -130,7 +130,7 @@ enum { · 123 unmodified lines | ||
| 130 | 130 | #include "tcc.h" |
| 131 | 131 | |
| 132 | 132 | ST_DATA const int reg_classes[NB_REGS] = { |
| 133 | − /* eax */ RC_INT | RC_FLOAT | RC_EAX, | |
| 133 | + /* eax */ RC_INT | RC_FLOAT | RC_EAX, | |
| 134 | 134 | // only allow even regs for floats (allow for doubles) |
| 135 | 135 | /* ecx */ RC_INT | RC_ECX, |
| 136 | 136 | /* edx */ RC_INT | RC_INT_BSIDE | RC_FLOAT | RC_EDX, |
| @@ -161,7 +161,7 @@ ST_DATA const int reg_classes[NB_REGS] = { · 24 unmodified lines | ||
| 161 | 161 | // although tcc thinks it is passing parameters on the stack, |
| 162 | 162 | // the C67 really passes up to the first 10 params in special |
| 163 | 163 | // regs or regs pairs (for 64 bit params). So keep track of |
| 164 | −// the stack offsets so we can translate to the appropriate | |
| 164 | +// the stack offsets so we can translate to the appropriate | |
| 165 | 165 | // reg (pair) |
| 166 | 166 | |
| 167 | 167 | #define NoCallArgsPassedOnStack 10 |
| @@ -246,7 +246,7 @@ void gsym(int t) · 78 unmodified lines | ||
| 246 | 246 | gsym_addr(t, ind); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | −// these are regs that tcc doesn't really know about, | |
| 249 | +// these are regs that tcc doesn't really know about, | |
| 250 | 250 | // but assign them unique values so the mapping routines |
| 251 | 251 | // can distinguish them |
| 252 | 252 | |
| @@ -298,7 +298,7 @@ int C67_map_regn(int r) · 45 unmodified lines | ||
| 298 | 298 | return 0; |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | −// mapping from tcc reg number to | |
| 301 | +// mapping from tcc reg number to | |
| 302 | 302 | // C67 register to condition code field |
| 303 | 303 | // |
| 304 | 304 | // valid condition code regs are: |
| @@ -343,15 +343,15 @@ int C67_map_regs(int r) · 38 unmodified lines | ||
| 343 | 343 | else if (r >= TREG_C67_A4 && r <= TREG_C67_B13) // these form a pattern of alt pairs |
| 344 | 344 | return (r & 2) >> 1; |
| 345 | 345 | else if (r == C67_A0) |
| 346 | − return 0; // set to A side | |
| 346 | + return 0; // set to A side | |
| 347 | 347 | else if (r == C67_B2) |
| 348 | − return 1; // set to B side | |
| 348 | + return 1; // set to B side | |
| 349 | 349 | else if (r == C67_B3) |
| 350 | 350 | return 1; // set to B side |
| 351 | 351 | else if (r == C67_SP) |
| 352 | − return 0x1; // set to SP (B15) B side | |
| 352 | + return 0x1; // set to SP (B15) B side | |
| 353 | 353 | else if (r == C67_FP) |
| 354 | − return 0x0; // set to FP (A15) A side | |
| 354 | + return 0x0; // set to FP (A15) A side | |
| 355 | 355 | else |
| 356 | 356 | ALWAYS_ASSERT(FALSE); |
| 357 | 357 | |
| @@ -420,7 +420,7 @@ void C67_asm(char *s, int a, int b, int c) · 62 unmodified lines | ||
| 420 | 420 | (5 << 9) | //mode 5 = pos offset, base reg + off reg |
| 421 | 421 | (0 << 8) | //r (LDDW bit 0) |
| 422 | 422 | (0 << 7) | //y D1/D2 A side |
| 423 | − (3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 423 | + (3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 424 | 424 | (1 << 2) | //opcode |
| 425 | 425 | (C67_map_regs(a) << 1) | //side of src |
| 426 | 426 | (0 << 0)); //parallel |
| @@ -442,7 +442,7 @@ void C67_asm(char *s, int a, int b, int c) · 15 unmodified lines | ||
| 442 | 442 | (5 << 9) | //mode 5 = pos offset, base reg + off reg |
| 443 | 443 | (0 << 8) | //r (LDDW bit 0) |
| 444 | 444 | (0 << 7) | //y D1/D2 A side |
| 445 | − (3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 445 | + (3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 446 | 446 | (1 << 2) | //opcode |
| 447 | 447 | (C67_map_regs(a) << 1) | //side of src |
| 448 | 448 | (0 << 0)); //parallel |
| @@ -464,7 +464,7 @@ void C67_asm(char *s, int a, int b, int c) · 15 unmodified lines | ||
| 464 | 464 | (5 << 9) | //mode 5 = pos offset, base reg + off reg |
| 465 | 465 | (0 << 8) | //r (LDDW bit 0) |
| 466 | 466 | (0 << 7) | //y D1/D2 A side |
| 467 | − (7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 467 | + (7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 468 | 468 | (1 << 2) | //opcode |
| 469 | 469 | (C67_map_regs(a) << 1) | //side of src |
| 470 | 470 | (0 << 0)); //parallel |
| @@ -475,7 +475,7 @@ void C67_asm(char *s, int a, int b, int c) · 4 unmodified lines | ||
| 475 | 475 | (1 << 9) | //mode 1 = pos cst offset |
| 476 | 476 | (0 << 8) | //r (LDDW bit 0) |
| 477 | 477 | (C67_map_regs(b) << 7) | //y D1/D2 base reg side |
| 478 | − (7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 478 | + (7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 479 | 479 | (1 << 2) | //opcode |
| 480 | 480 | (C67_map_regs(a) << 1) | //side of src |
| 481 | 481 | (0 << 0)); //parallel |
| @@ -486,7 +486,7 @@ void C67_asm(char *s, int a, int b, int c) · 4 unmodified lines | ||
| 486 | 486 | (1 << 9) | //mode 1 = pos cst offset |
| 487 | 487 | (0 << 8) | //r (LDDW bit 0) |
| 488 | 488 | (C67_map_regs(b) << 7) | //y D1/D2 base reg side |
| 489 | − (5 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 489 | + (5 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 490 | 490 | (1 << 2) | //opcode |
| 491 | 491 | (C67_map_regs(a) << 1) | //side of src |
| 492 | 492 | (0 << 0)); //parallel |
| @@ -497,7 +497,7 @@ void C67_asm(char *s, int a, int b, int c) · 4 unmodified lines | ||
| 497 | 497 | (1 << 9) | //mode 1 = pos cst offset |
| 498 | 498 | (0 << 8) | //r (LDDW bit 0) |
| 499 | 499 | (C67_map_regs(b) << 7) | //y D1/D2 base reg side |
| 500 | − (3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 500 | + (3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 501 | 501 | (1 << 2) | //opcode |
| 502 | 502 | (C67_map_regs(a) << 1) | //side of src |
| 503 | 503 | (0 << 0)); //parallel |
| @@ -509,7 +509,7 @@ void C67_asm(char *s, int a, int b, int c) · 5 unmodified lines | ||
| 509 | 509 | (1 << 9) | //mode 1 = pos cst offset |
| 510 | 510 | (0 << 8) | //r (LDDW bit 0) |
| 511 | 511 | (C67_map_regs(b) << 7) | //y D1/D2 base reg side |
| 512 | − (7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 512 | + (7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 513 | 513 | (1 << 2) | //opcode |
| 514 | 514 | (C67_map_regs(a) << 1) | //side of src |
| 515 | 515 | (0 << 0)); //parallel |
| @@ -641,7 +641,7 @@ void C67_asm(char *s, int a, int b, int c) · 125 unmodified lines | ||
| 641 | 641 | (1 << 9) | //mode 1 = pos cst offset |
| 642 | 642 | (0 << 8) | //r (LDDW bit 0) |
| 643 | 643 | (C67_map_regs(a) << 7) | //y D1/D2 src side |
| 644 | − (2 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 644 | + (2 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 645 | 645 | (1 << 2) | //opcode |
| 646 | 646 | (C67_map_regs(b) << 1) | //side of dst |
| 647 | 647 | (0 << 0)); //parallel |
| @@ -652,7 +652,7 @@ void C67_asm(char *s, int a, int b, int c) · 4 unmodified lines | ||
| 652 | 652 | (1 << 9) | //mode 1 = pos cst offset |
| 653 | 653 | (0 << 8) | //r (LDDW bit 0) |
| 654 | 654 | (C67_map_regs(a) << 7) | //y D1/D2 src side |
| 655 | − (0 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 655 | + (0 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 656 | 656 | (1 << 2) | //opcode |
| 657 | 657 | (C67_map_regs(b) << 1) | //side of dst |
| 658 | 658 | (0 << 0)); //parallel |
| @@ -674,7 +674,7 @@ void C67_asm(char *s, int a, int b, int c) · 15 unmodified lines | ||
| 674 | 674 | (1 << 9) | //mode 1 = pos cst offset |
| 675 | 675 | (0 << 8) | //r (LDDW bit 0) |
| 676 | 676 | (C67_map_regs(a) << 7) | //y D1/D2 src side |
| 677 | − (6 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 677 | + (6 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU | |
| 678 | 678 | (1 << 2) | //opcode |
| 679 | 679 | (C67_map_regs(b) << 1) | //side of dst |
| 680 | 680 | (0 << 0)); //parallel |
| @@ -877,7 +877,7 @@ void C67_asm(char *s, int a, int b, int c) · 196 unmodified lines | ||
| 877 | 877 | C67_g((0 << 29) | //creg |
| 878 | 878 | (0 << 28) | //inv |
| 879 | 879 | (C67_map_regn(c) << 23) | //dst |
| 880 | − (C67_map_regn(b) << 18) | //src2 | |
| 880 | + (C67_map_regn(b) << 18) | //src2 | |
| 881 | 881 | (0 << 13) | //src1 NA |
| 882 | 882 | (xpath << 12) | //x cross path if opposite sides |
| 883 | 883 | (0x4a << 5) | //opcode |
| @@ -890,7 +890,7 @@ void C67_asm(char *s, int a, int b, int c) · 6 unmodified lines | ||
| 890 | 890 | C67_g((0 << 29) | //creg |
| 891 | 891 | (0 << 28) | //inv |
| 892 | 892 | (C67_map_regn(c) << 23) | //dst |
| 893 | − (C67_map_regn(b) << 18) | //src2 | |
| 893 | + (C67_map_regn(b) << 18) | //src2 | |
| 894 | 894 | (0 << 13) | //src1 NA |
| 895 | 895 | (xpath << 12) | //x cross path if opposite sides |
| 896 | 896 | (0x49 << 5) | //opcode |
| @@ -903,7 +903,7 @@ void C67_asm(char *s, int a, int b, int c) · 6 unmodified lines | ||
| 903 | 903 | C67_g((0 << 29) | //creg |
| 904 | 904 | (0 << 28) | //inv |
| 905 | 905 | (C67_map_regn(c) << 23) | //dst |
| 906 | − (C67_map_regn(b) << 18) | //src2 | |
| 906 | + (C67_map_regn(b) << 18) | //src2 | |
| 907 | 907 | (0 << 13) | //src1 NA |
| 908 | 908 | (xpath << 12) | //x cross path if opposite sides |
| 909 | 909 | (0x39 << 5) | //opcode |
| @@ -958,7 +958,7 @@ void C67_asm(char *s, int a, int b, int c) · 48 unmodified lines | ||
| 958 | 958 | (0 << 28) | //inv |
| 959 | 959 | (C67_map_regn(c) << 23) | //dst |
| 960 | 960 | (C67_map_regn(b) << 18) | //src2 (possible x path) |
| 961 | − (C67_map_regn(a) << 13) | //src1 | |
| 961 | + (C67_map_regn(a) << 13) | //src1 | |
| 962 | 962 | (xpath << 12) | //x cross path if opposite sides |
| 963 | 963 | (0x3 << 5) | //opcode |
| 964 | 964 | (0x6 << 2) | //opcode fixed |
| @@ -973,7 +973,7 @@ void C67_asm(char *s, int a, int b, int c) · 8 unmodified lines | ||
| 973 | 973 | (0 << 28) | //inv |
| 974 | 974 | (C67_map_regn(c) << 23) | //dst |
| 975 | 975 | (C67_map_regn(b) << 18) | //src2 (possible x path) |
| 976 | − (C67_map_regn(a) << 13) | //src1 | |
| 976 | + (C67_map_regn(a) << 13) | //src1 | |
| 977 | 977 | (xpath << 12) | //x cross path if opposite sides |
| 978 | 978 | (0x7 << 5) | //opcode |
| 979 | 979 | (0x6 << 2) | //opcode fixed |
| @@ -988,7 +988,7 @@ void C67_asm(char *s, int a, int b, int c) · 8 unmodified lines | ||
| 988 | 988 | (0 << 28) | //inv |
| 989 | 989 | (C67_map_regn(c) << 23) | //dst |
| 990 | 990 | (C67_map_regn(b) << 18) | //src2 (possible x path) |
| 991 | − (C67_map_regn(a) << 13) | //src1 | |
| 991 | + (C67_map_regn(a) << 13) | //src1 | |
| 992 | 992 | (xpath << 12) | //x cross path if opposite sides |
| 993 | 993 | (0x7f << 5) | //opcode |
| 994 | 994 | (0x6 << 2) | //opcode fixed |
| @@ -1003,7 +1003,7 @@ void C67_asm(char *s, int a, int b, int c) · 8 unmodified lines | ||
| 1003 | 1003 | (0 << 28) | //inv |
| 1004 | 1004 | (C67_map_regn(c) << 23) | //dst |
| 1005 | 1005 | (C67_map_regn(b) << 18) | //src2 (possible x path) |
| 1006 | − (C67_map_regn(a) << 13) | //src1 | |
| 1006 | + (C67_map_regn(a) << 13) | //src1 | |
| 1007 | 1007 | (xpath << 12) | //x cross path if opposite sides |
| 1008 | 1008 | (0x7b << 5) | //opcode |
| 1009 | 1009 | (0x6 << 2) | //opcode fixed |
| @@ -1018,7 +1018,7 @@ void C67_asm(char *s, int a, int b, int c) · 8 unmodified lines | ||
| 1018 | 1018 | (0 << 28) | //inv |
| 1019 | 1019 | (C67_map_regn(c) << 23) | //dst |
| 1020 | 1020 | (C67_map_regn(b) << 18) | //src2 (possible x path) |
| 1021 | − (C67_map_regn(a) << 13) | //src1 | |
| 1021 | + (C67_map_regn(a) << 13) | //src1 | |
| 1022 | 1022 | (xpath << 12) | //x cross path if opposite sides |
| 1023 | 1023 | (0x6f << 5) | //opcode |
| 1024 | 1024 | (0x6 << 2) | //opcode fixed |
| @@ -1033,7 +1033,7 @@ void C67_asm(char *s, int a, int b, int c) · 8 unmodified lines | ||
| 1033 | 1033 | (0 << 28) | //inv |
| 1034 | 1034 | (C67_map_regn(c) << 23) | //dst |
| 1035 | 1035 | (C67_map_regn(b) << 18) | //src2 (possible x path) |
| 1036 | − (C67_map_regn(a) << 13) | //src1 | |
| 1036 | + (C67_map_regn(a) << 13) | //src1 | |
| 1037 | 1037 | (xpath << 12) | //x cross path if opposite sides |
| 1038 | 1038 | (0x10 << 5) | //opcode |
| 1039 | 1039 | (0x6 << 2) | //opcode fixed |
| @@ -1048,7 +1048,7 @@ void C67_asm(char *s, int a, int b, int c) · 8 unmodified lines | ||
| 1048 | 1048 | (0 << 28) | //inv |
| 1049 | 1049 | (C67_map_regn(c) << 23) | //dst |
| 1050 | 1050 | (C67_map_regn(b) << 18) | //src2 (possible x path) |
| 1051 | − (C67_map_regn(a) << 13) | //src1 | |
| 1051 | + (C67_map_regn(a) << 13) | //src1 | |
| 1052 | 1052 | (xpath << 12) | //x cross path if opposite sides |
| 1053 | 1053 | (0x18 << 5) | //opcode |
| 1054 | 1054 | (0x6 << 2) | //opcode fixed |
| @@ -1063,7 +1063,7 @@ void C67_asm(char *s, int a, int b, int c) · 8 unmodified lines | ||
| 1063 | 1063 | (0 << 28) | //inv |
| 1064 | 1064 | (C67_map_regn(c) << 23) | //dst |
| 1065 | 1065 | (C67_map_regn(b) << 18) | //src2 (possible x path) |
| 1066 | − (C67_map_regn(a) << 13) | //src1 | |
| 1066 | + (C67_map_regn(a) << 13) | //src1 | |
| 1067 | 1067 | (xpath << 12) | //x cross path if opposite sides |
| 1068 | 1068 | (0x11 << 5) | //opcode |
| 1069 | 1069 | (0x6 << 2) | //opcode fixed |
| @@ -1078,7 +1078,7 @@ void C67_asm(char *s, int a, int b, int c) · 8 unmodified lines | ||
| 1078 | 1078 | (0 << 28) | //inv |
| 1079 | 1079 | (C67_map_regn(c) << 23) | //dst |
| 1080 | 1080 | (C67_map_regn(b) << 18) | //src2 (possible x path) |
| 1081 | − (C67_map_regn(a) << 13) | //src1 | |
| 1081 | + (C67_map_regn(a) << 13) | //src1 | |
| 1082 | 1082 | (xpath << 12) | //x cross path if opposite sides |
| 1083 | 1083 | (0x19 << 5) | //opcode |
| 1084 | 1084 | (0x6 << 2) | //opcode fixed |
| @@ -1093,7 +1093,7 @@ void C67_asm(char *s, int a, int b, int c) · 8 unmodified lines | ||
| 1093 | 1093 | (0 << 28) | //inv |
| 1094 | 1094 | (C67_map_regn(c) << 23) | //dst |
| 1095 | 1095 | (C67_map_regn(b) << 18) | //src2 (possible x path) |
| 1096 | − (C67_map_regn(a) << 13) | //src1 | |
| 1096 | + (C67_map_regn(a) << 13) | //src1 | |
| 1097 | 1097 | (xpath << 12) | //x cross path if opposite sides |
| 1098 | 1098 | (0x1c << 7) | //opcode |
| 1099 | 1099 | (0x0 << 2) | //opcode fixed |
| @@ -1108,7 +1108,7 @@ void C67_asm(char *s, int a, int b, int c) · 8 unmodified lines | ||
| 1108 | 1108 | (0 << 28) | //inv |
| 1109 | 1109 | (C67_map_regn(c) << 23) | //dst |
| 1110 | 1110 | (C67_map_regn(b) << 18) | //src2 (possible x path) |
| 1111 | − (C67_map_regn(a) << 13) | //src1 | |
| 1111 | + (C67_map_regn(a) << 13) | //src1 | |
| 1112 | 1112 | (xpath << 12) | //x cross path if opposite sides |
| 1113 | 1113 | (0x0e << 7) | //opcode |
| 1114 | 1114 | (0x0 << 2) | //opcode fixed |
| @@ -1138,7 +1138,7 @@ void C67_asm(char *s, int a, int b, int c) · 23 unmodified lines | ||
| 1138 | 1138 | (0 << 28) | //inv |
| 1139 | 1139 | (C67_map_regn(c) << 23) | //dst |
| 1140 | 1140 | (C67_map_regn(b) << 18) | //src2 |
| 1141 | − (C67_map_regn(a) << 13) | //src1 | |
| 1141 | + (C67_map_regn(a) << 13) | //src1 | |
| 1142 | 1142 | (xpath << 12) | //x cross path if opposite sides |
| 1143 | 1143 | (0x37 << 6) | //opcode |
| 1144 | 1144 | (0x8 << 2) | //opcode fixed |
| @@ -1153,7 +1153,7 @@ void C67_asm(char *s, int a, int b, int c) · 8 unmodified lines | ||
| 1153 | 1153 | (0 << 28) | //inv |
| 1154 | 1154 | (C67_map_regn(c) << 23) | //dst |
| 1155 | 1155 | (C67_map_regn(b) << 18) | //src2 |
| 1156 | − (C67_map_regn(a) << 13) | //src1 | |
| 1156 | + (C67_map_regn(a) << 13) | //src1 | |
| 1157 | 1157 | (xpath << 12) | //x cross path if opposite sides |
| 1158 | 1158 | (0x27 << 6) | //opcode |
| 1159 | 1159 | (0x8 << 2) | //opcode fixed |
| @@ -1168,7 +1168,7 @@ void C67_asm(char *s, int a, int b, int c) · 8 unmodified lines | ||
| 1168 | 1168 | (0 << 28) | //inv |
| 1169 | 1169 | (C67_map_regn(c) << 23) | //dst |
| 1170 | 1170 | (C67_map_regn(b) << 18) | //src2 |
| 1171 | − (C67_map_regn(a) << 13) | //src1 | |
| 1171 | + (C67_map_regn(a) << 13) | //src1 | |
| 1172 | 1172 | (xpath << 12) | //x cross path if opposite sides |
| 1173 | 1173 | (0x33 << 6) | //opcode |
| 1174 | 1174 | (0x8 << 2) | //opcode fixed |
| @@ -1597,7 +1597,7 @@ void load(int r, SValue * sv) · 422 unmodified lines | ||
| 1597 | 1597 | size = 4; |
| 1598 | 1598 | } |
| 1599 | 1599 | |
| 1600 | − // check if fc is a positive reference on the stack, | |
| 1600 | + // check if fc is a positive reference on the stack, | |
| 1601 | 1601 | // if it is tcc is referencing what it thinks is a parameter |
| 1602 | 1602 | // on the stack, so check if it is really in a register. |
| 1603 | 1603 | |
| @@ -1962,7 +1962,7 @@ void gfunc_call(int nb_args) · 358 unmodified lines | ||
| 1962 | 1962 | // ending with B12:B13. |
| 1963 | 1963 | // |
| 1964 | 1964 | // When a call is made, if the caller has its parameters |
| 1965 | −// in regs A4-B13 these must be saved before/as the call | |
| 1965 | +// in regs A4-B13 these must be saved before/as the call | |
| 1966 | 1966 | // parameters are loaded and restored upon return (or if/when needed). |
| 1967 | 1967 | |
| 1968 | 1968 | /* generate function prolog of type 't' */ |
| @@ -2033,7 +2033,7 @@ void gfunc_prolog(CType * func_type) · 64 unmodified lines | ||
| 2033 | 2033 | |
| 2034 | 2034 | TotalBytesPushedOnStack = -loc; |
| 2035 | 2035 | |
| 2036 | − func_sub_sp_offset = ind; // remember where we put the stack instruction | |
| 2036 | + func_sub_sp_offset = ind; // remember where we put the stack instruction | |
| 2037 | 2037 | C67_ADDK(0, C67_SP); // ADDK.L2 loc,SP (just put zero temporarily) |
| 2038 | 2038 | |
| 2039 | 2039 | C67_PUSH(C67_A0); |
| @@ -2049,11 +2049,11 @@ void gfunc_epilog(void) · 9 unmodified lines | ||
| 2049 | 2049 | C67_NOP(4); // NOP wait for load |
| 2050 | 2050 | C67_IREG_B_REG(0, C67_CREG_ZERO, C67_B3); // B.S2 B3 |
| 2051 | 2051 | C67_POP(C67_FP); |
| 2052 | − C67_ADDK(local, C67_SP); // ADDK.L2 loc,SP | |
| 2052 | + C67_ADDK(local, C67_SP); // ADDK.L2 loc,SP | |
| 2053 | 2053 | C67_Adjust_ADDK((int *) (cur_text_section->data + |
| 2054 | 2054 | func_sub_sp_offset), |
| 2055 | 2055 | -local + TotalBytesPushedOnStack); |
| 2056 | − C67_NOP(3); // NOP | |
| 2056 | + C67_NOP(3); // NOP | |
| 2057 | 2057 | } |
| 2058 | 2058 | } |
| 2059 | 2059 | |
| @@ -31,9 +31,9 @@ struct filehdr { · 30 unmodified lines | ||
| 31 | 31 | #define F_LITTLE 0x100 /* byte ordering of an AR32WR (vax) */ |
| 32 | 32 | #define F_BIG 0x200 /* byte ordering of an AR32W (3B, maxi) */ |
| 33 | 33 | #define F_PATCH 0x400 /* contains "patch" list in optional header */ |
| 34 | −#define F_NODF 0x400 | |
| 34 | +#define F_NODF 0x400 | |
| 35 | 35 | |
| 36 | −#define F_VERSION (F_GSP10 | F_GSP20) | |
| 36 | +#define F_VERSION (F_GSP10 | F_GSP20) | |
| 37 | 37 | #define F_BYTE_ORDER (F_LITTLE | F_BIG) |
| 38 | 38 | #define FILHDR struct filehdr |
| 39 | 39 | |
| @@ -68,7 +68,7 @@ typedef struct aouthdr { · 28 unmodified lines | ||
| 68 | 68 | |
| 69 | 69 | /*----------------------------------------------------------------------*/ |
| 70 | 70 | /* When a UNIX aout header is to be built in the optional header, */ |
| 71 | −/* the following magic numbers can appear in that header: */ | |
| 71 | +/* the following magic numbers can appear in that header: */ | |
| 72 | 72 | /* */ |
| 73 | 73 | /* AOUT1MAGIC : default : readonly sharable text segment */ |
| 74 | 74 | /* AOUT2MAGIC: : writable text segment */ |
| @@ -164,7 +164,7 @@ struct scnhdr { · 89 unmodified lines | ||
| 164 | 164 | #define STYP_NOLOAD 0x02 /* "noload" : allocated, relocated, not loaded */ |
| 165 | 165 | #define STYP_GROUP 0x04 /* "grouped" : formed of input sections */ |
| 166 | 166 | #define STYP_PAD 0x08 /* "padding" : not allocated, not relocated, loaded */ |
| 167 | −#define STYP_COPY 0x10 /* "copy" : used for C init tables - | |
| 167 | +#define STYP_COPY 0x10 /* "copy" : used for C init tables - | |
| 168 | 168 | not allocated, relocated, |
| 169 | 169 | loaded; reloc & lineno |
| 170 | 170 | entries processed normally */ |
| @@ -358,11 +358,11 @@ struct syment · 187 unmodified lines | ||
| 358 | 358 | #define N_BTSHFT_COFF 4 |
| 359 | 359 | #define N_TSHIFT_COFF 2 |
| 360 | 360 | |
| 361 | −#define BTYPE_COFF(x) ((x) & N_BTMASK_COFF) | |
| 361 | +#define BTYPE_COFF(x) ((x) & N_BTMASK_COFF) | |
| 362 | 362 | #define ISINT(x) (((x) >= T_CHAR && (x) <= T_LONG) || \ |
| 363 | 363 | ((x) >= T_UCHAR && (x) <= T_ULONG) || (x) == T_ENUM) |
| 364 | 364 | #define ISFLT_COFF(x) ((x) == T_DOUBLE || (x) == T_FLOAT) |
| 365 | −#define ISPTR_COFF(x) (((x) & N_TMASK_COFF) == (DT_PTR << N_BTSHFT_COFF)) | |
| 365 | +#define ISPTR_COFF(x) (((x) & N_TMASK_COFF) == (DT_PTR << N_BTSHFT_COFF)) | |
| 366 | 366 | #define ISFCN_COFF(x) (((x) & N_TMASK_COFF) == (DT_FCN << N_BTSHFT_COFF)) |
| 367 | 367 | #define ISARY_COFF(x) (((x) & N_TMASK_COFF) == (DT_ARY << N_BTSHFT_COFF)) |
| 368 | 368 | #define ISTAG_COFF(x) ((x)==C_STRTAG || (x)==C_UNTAG || (x)==C_ENTAG) |
| @@ -66,7 +66,7 @@ case $targetos in · 65 unmodified lines | ||
| 66 | 66 | esac |
| 67 | 67 | |
| 68 | 68 | # find source path |
| 69 | −# XXX: we assume an absolute path is given when launching configure, | |
| 69 | +# XXX: we assume an absolute path is given when launching configure, | |
| 70 | 70 | # except in './configure' case. |
| 71 | 71 | source_path=${0%configure} |
| 72 | 72 | source_path=${source_path%/} |
| @@ -712,7 +712,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) · 711 unmodified lines | ||
| 712 | 712 | a32 = addr32 = 1; |
| 713 | 713 | } |
| 714 | 714 | #endif |
| 715 | − if (b & 0xff00) | |
| 715 | + if (b & 0xff00) | |
| 716 | 716 | g(b >> 8); |
| 717 | 717 | g(b); |
| 718 | 718 | return; |
| @@ -57,7 +57,7 @@ ALT(DEF_ASM_OP0L(stosb, 0xaa, 0, OPC_BWL)) · 56 unmodified lines | ||
| 57 | 57 | ALT(DEF_ASM_OP0L(sstob, 0xaa, 0, OPC_BWL)) |
| 58 | 58 | |
| 59 | 59 | /* bits */ |
| 60 | − | |
| 60 | + | |
| 61 | 61 | ALT(DEF_ASM_OP2(bsfw, 0x0fbc, 0, OPC_MODRM | OPC_WL, OPT_REGW | OPT_EA, OPT_REGW)) |
| 62 | 62 | ALT(DEF_ASM_OP2(bsrw, 0x0fbd, 0, OPC_MODRM | OPC_WL, OPT_REGW | OPT_EA, OPT_REGW)) |
| 63 | 63 | |
| @@ -91,7 +91,7 @@ ALT(DEF_ASM_OP2(btcw, 0x0fba, 7, OPC_MODRM | OPC_WL, OPT_IM8, OPT_REGW | OPT_EA) · 27 unmodified lines | ||
| 91 | 91 | DEF_ASM_OP0(repz, 0xf3) |
| 92 | 92 | DEF_ASM_OP0(repne, 0xf2) |
| 93 | 93 | DEF_ASM_OP0(repnz, 0xf2) |
| 94 | − | |
| 94 | + | |
| 95 | 95 | DEF_ASM_OP0(invd, 0x0f08) |
| 96 | 96 | DEF_ASM_OP0(wbinvd, 0x0f09) |
| 97 | 97 | DEF_ASM_OP0(cpuid, 0x0fa2) |
| @@ -236,7 +236,7 @@ ALT(DEF_ASM_OP1(jo, 0x70, 0, OPC_SHORTJMP | OPC_JMP | OPC_TEST, OPT_ADDR)) · 138 unmodified lines | ||
| 236 | 236 | DEF_ASM_OP1(loopz, 0xe1, 0, OPC_SHORTJMP, OPT_ADDR) |
| 237 | 237 | DEF_ASM_OP1(loop, 0xe2, 0, OPC_SHORTJMP, OPT_ADDR) |
| 238 | 238 | DEF_ASM_OP1(jecxz, 0xe3, 0, OPC_SHORTJMP, OPT_ADDR) |
| 239 | − | |
| 239 | + | |
| 240 | 240 | /* float */ |
| 241 | 241 | /* specific fcomp handling */ |
| 242 | 242 | ALT(DEF_ASM_OP0L(fcomp, 0xd8d9, 0, 0)) |
| @@ -298,7 +298,7 @@ ALT(DEF_ASM_OP1(fldl, 0xdd, 0, OPC_MODRM, OPT_EA)) · 55 unmodified lines | ||
| 298 | 298 | DEF_ASM_OP1(fildll, 0xdf, 5, OPC_MODRM,OPT_EA) |
| 299 | 299 | DEF_ASM_OP1(fldt, 0xdb, 5, OPC_MODRM, OPT_EA) |
| 300 | 300 | DEF_ASM_OP1(fbld, 0xdf, 4, OPC_MODRM, OPT_EA) |
| 301 | − | |
| 301 | + | |
| 302 | 302 | /* fp store */ |
| 303 | 303 | DEF_ASM_OP1(fst, 0xddd0, 0, OPC_REG, OPT_ST) |
| 304 | 304 | DEF_ASM_OP1(fstl, 0xddd0, 0, OPC_REG, OPT_ST) |
| @@ -380,7 +380,7 @@ ALT(DEF_ASM_OP2(cmpxchgb, 0x0fb0, 0, OPC_MODRM | OPC_BWL, OPT_REG, OPT_REG | OPT · 75 unmodified lines | ||
| 380 | 380 | |
| 381 | 381 | /* pentium */ |
| 382 | 382 | DEF_ASM_OP1(cmpxchg8b, 0x0fc7, 1, OPC_MODRM, OPT_EA ) |
| 383 | − | |
| 383 | + | |
| 384 | 384 | /* pentium pro */ |
| 385 | 385 | ALT(DEF_ASM_OP2(cmovo, 0x0f40, 0, OPC_MODRM | OPC_TEST, OPT_REG32 | OPT_EA, OPT_REG32)) |
| 386 | 386 | #ifdef I386_ASM_16 |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * X86 code generator for TCC |
| 3 | − * | |
| 3 | + * | |
| 4 | 4 | * Copyright (c) 2001-2004 Fabrice Bellard |
| 5 | 5 | * |
| 6 | 6 | * This library is free software; you can redistribute it and/or |
| @@ -32,7 +32,7 @@ typedef int RegArgs; · 25 unmodified lines | ||
| 32 | 32 | #define RC_INT 0x0001 /* generic integer register */ |
| 33 | 33 | #define RC_FLOAT 0x0002 /* generic float register */ |
| 34 | 34 | #define RC_EAX 0x0004 |
| 35 | −#define RC_ST0 0x0008 | |
| 35 | +#define RC_ST0 0x0008 | |
| 36 | 36 | #define RC_ECX 0x0010 |
| 37 | 37 | #define RC_EDX 0x0020 |
| 38 | 38 | #define RC_IRET RC_EAX /* function return: integer register */ |
| @@ -357,11 +357,11 @@ static void gcall_or_jmp(int is_jmp) · 318 unmodified lines | ||
| 357 | 357 | /* constant case */ |
| 358 | 358 | if (vtop->r & VT_SYM) { |
| 359 | 359 | /* relocation case */ |
| 360 | − greloc(cur_text_section, vtop->sym, | |
| 360 | + greloc(cur_text_section, vtop->sym, | |
| 361 | 361 | ind + 1, R_386_PC32); |
| 362 | 362 | } else { |
| 363 | 363 | /* put an empty PC32 relocation */ |
| 364 | − put_elf_reloc(symtab_section, cur_text_section, | |
| 364 | + put_elf_reloc(symtab_section, cur_text_section, | |
| 365 | 365 | ind + 1, R_386_PC32, 0); |
| 366 | 366 | } |
| 367 | 367 | oad(0xe8 + is_jmp, vtop->c.ul - 4); /* call/jmp im */ |
| @@ -417,7 +417,7 @@ ST_FUNC void gfunc_call(int nb_args) · 49 unmodified lines | ||
| 417 | 417 | { |
| 418 | 418 | int size, align, r, args_size, i, func_call; |
| 419 | 419 | Sym *func_sym; |
| 420 | − | |
| 420 | + | |
| 421 | 421 | args_size = 0; |
| 422 | 422 | for(i = 0;i < nb_args; i++) { |
| 423 | 423 | if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) { |
| @@ -610,7 +610,7 @@ ST_FUNC void gfunc_epilog(void) · 186 unmodified lines | ||
| 610 | 610 | /* generate bound local allocation */ |
| 611 | 611 | saved_ind = ind; |
| 612 | 612 | ind = func_sub_sp_offset; |
| 613 | − sym_data = get_sym_ref(&char_pointer_type, lbounds_section, | |
| 613 | + sym_data = get_sym_ref(&char_pointer_type, lbounds_section, | |
| 614 | 614 | func_bound_offset, lbounds_section->data_offset); |
| 615 | 615 | greloc(cur_text_section, sym_data, |
| 616 | 616 | ind + 1, R_386_32); |
| @@ -637,8 +637,8 @@ ST_FUNC void gfunc_epilog(void) · 20 unmodified lines | ||
| 637 | 637 | g(func_ret_sub >> 8); |
| 638 | 638 | } |
| 639 | 639 | /* align local size to word & save local variables */ |
| 640 | − | |
| 641 | − v = (-loc + 3) & -4; | |
| 640 | + | |
| 641 | + v = (-loc + 3) & -4; | |
| 642 | 642 | saved_ind = ind; |
| 643 | 643 | ind = func_sub_sp_offset - FUNC_PROLOG_SIZE; |
| 644 | 644 | #ifdef TCC_TARGET_PE |
| @@ -741,7 +741,7 @@ ST_FUNC void gen_opi(int op) · 96 unmodified lines | ||
| 741 | 741 | r = vtop[-1].r; |
| 742 | 742 | fr = vtop[0].r; |
| 743 | 743 | o((opc << 3) | 0x01); |
| 744 | − o(0xc0 + r + fr * 8); | |
| 744 | + o(0xc0 + r + fr * 8); | |
| 745 | 745 | } |
| 746 | 746 | vtop--; |
| 747 | 747 | if (op >= TOK_ULT && op <= TOK_GT) { |
| @@ -911,7 +911,7 @@ ST_FUNC void gen_opf(int op) · 163 unmodified lines | ||
| 911 | 911 | load(TREG_ST0, vtop); |
| 912 | 912 | swapped = !swapped; |
| 913 | 913 | } |
| 914 | − | |
| 914 | + | |
| 915 | 915 | switch(op) { |
| 916 | 916 | default: |
| 917 | 917 | case '+': |
| @@ -972,7 +972,7 @@ ST_FUNC void gen_cvt_itof(int t) · 54 unmodified lines | ||
| 972 | 972 | o(0x50 + (vtop->r & VT_VALMASK)); /* push r */ |
| 973 | 973 | o(0x242cdf); /* fildll (%esp) */ |
| 974 | 974 | o(0x08c483); /* add $8, %esp */ |
| 975 | − } else if ((vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) == | |
| 975 | + } else if ((vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) == | |
| 976 | 976 | (VT_INT | VT_UNSIGNED)) { |
| 977 | 977 | /* unsigned int to float/double/long double */ |
| 978 | 978 | o(0x6a); /* push $0 */ |
| @@ -1060,7 +1060,7 @@ ST_FUNC void gen_bounded_ptr_add(void) · 81 unmodified lines | ||
| 1060 | 1060 | vtop++; |
| 1061 | 1061 | vtop->r = TREG_EAX | VT_BOUNDED; |
| 1062 | 1062 | /* address of bounding function call point */ |
| 1063 | − vtop->c.ul = (cur_text_section->reloc->data_offset - sizeof(Elf32_Rel)); | |
| 1063 | + vtop->c.ul = (cur_text_section->reloc->data_offset - sizeof(Elf32_Rel)); | |
| 1064 | 1064 | } |
| 1065 | 1065 | |
| 1066 | 1066 | /* patch pointer addition in vtop so that pointer dereferencing is |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * CIL code generator for TCC |
| 3 | − * | |
| 3 | + * | |
| 4 | 4 | * Copyright (c) 2002 Fabrice Bellard |
| 5 | 5 | * |
| 6 | 6 | * This library is free software; you can redistribute it and/or |
| @@ -112,7 +112,7 @@ static void init_outfile(void) · 105 unmodified lines | ||
| 112 | 112 | { |
| 113 | 113 | if (!il_outfile) { |
| 114 | 114 | il_outfile = stdout; |
| 115 | − fprintf(il_outfile, | |
| 115 | + fprintf(il_outfile, | |
| 116 | 116 | ".assembly extern mscorlib\n" |
| 117 | 117 | "{\n" |
| 118 | 118 | ".ver 1:0:2411:0\n" |
| @@ -149,7 +149,7 @@ static void out_opi(int op, int c) · 30 unmodified lines | ||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /* XXX: not complete */ |
| 152 | −static void il_type_to_str(char *buf, int buf_size, | |
| 152 | +static void il_type_to_str(char *buf, int buf_size, | |
| 153 | 153 | int t, const char *varstr) |
| 154 | 154 | { |
| 155 | 155 | int bt; |
| @@ -301,12 +301,12 @@ void load(int r, SValue *sv) · 145 unmodified lines | ||
| 301 | 301 | out_op(IL_OP_LDIND_U2); |
| 302 | 302 | else |
| 303 | 303 | out_op(IL_OP_LDIND_I4); |
| 304 | − } | |
| 304 | + } | |
| 305 | 305 | } else { |
| 306 | 306 | if (v == VT_CONST) { |
| 307 | 307 | /* XXX: handle globals */ |
| 308 | 308 | if (fc >= -1 && fc <= 8) { |
| 309 | − out_op(IL_OP_LDC_I4_M1 + fc + 1); | |
| 309 | + out_op(IL_OP_LDC_I4_M1 + fc + 1); | |
| 310 | 310 | } else { |
| 311 | 311 | out_opi(IL_OP_LDC_I4, fc); |
| 312 | 312 | } |
| @@ -430,10 +430,10 @@ void gfunc_prolog(int t) · 117 unmodified lines | ||
| 430 | 430 | /* XXX: cannot do better now */ |
| 431 | 431 | fprintf(il_outfile, " .maxstack %d\n", NB_REGS); |
| 432 | 432 | fprintf(il_outfile, " .locals (int32, int32, int32, int32, int32, int32, int32, int32)\n"); |
| 433 | − | |
| 433 | + | |
| 434 | 434 | if (!strcmp(funcname, "main")) |
| 435 | 435 | fprintf(il_outfile, " .entrypoint\n"); |
| 436 | − | |
| 436 | + | |
| 437 | 437 | sym = sym_find((unsigned)t >> VT_STRUCT_SHIFT); |
| 438 | 438 | func_call = sym->r; |
| 439 | 439 | |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * CIL opcode definition |
| 3 | − * | |
| 3 | + * | |
| 4 | 4 | * Copyright (c) 2002 Fabrice Bellard |
| 5 | 5 | * |
| 6 | 6 | * This program is free software; you can redistribute it and/or modify |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * Tiny C Memory and bounds checker |
| 3 | − * | |
| 3 | + * | |
| 4 | 4 | * Copyright (c) 2002 Fabrice Bellard |
| 5 | 5 | * |
| 6 | 6 | * This library is free software; you can redistribute it and/or |
| @@ -88,7 +88,7 @@ int __bound_delete_region(void *p); · 81 unmodified lines | ||
| 88 | 88 | |
| 89 | 89 | #ifdef __attribute__ |
| 90 | 90 | /* an __attribute__ macro is defined in the system headers */ |
| 91 | − #undef __attribute__ | |
| 91 | + #undef __attribute__ | |
| 92 | 92 | #endif |
| 93 | 93 | #define FASTCALL __attribute__((regparm(3))) |
| 94 | 94 | |
| @@ -177,8 +177,8 @@ void * FASTCALL __bound_ptr_add(void *p, size_t offset) · 82 unmodified lines | ||
| 177 | 177 | dprintf(stderr, "%s %s: %p %p\n", __FILE__, __FUNCTION__, p, offset); |
| 178 | 178 | |
| 179 | 179 | e = __bound_t1[addr >> (BOUND_T2_BITS + BOUND_T3_BITS)]; |
| 180 | − e = (BoundEntry *)((char *)e + | |
| 181 | − ((addr >> (BOUND_T3_BITS - BOUND_E_BITS)) & | |
| 180 | + e = (BoundEntry *)((char *)e + | |
| 181 | + ((addr >> (BOUND_T3_BITS - BOUND_E_BITS)) & | |
| 182 | 182 | ((BOUND_T2_SIZE - 1) << BOUND_E_BITS))); |
| 183 | 183 | addr -= e->start; |
| 184 | 184 | if (addr > e->size) { |
| @@ -236,7 +236,7 @@ BOUND_PTR_INDIR(16) · 51 unmodified lines | ||
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /* called when entering a function to add all the local regions */ |
| 239 | −void FASTCALL __bound_local_new(void *p1) | |
| 239 | +void FASTCALL __bound_local_new(void *p1) | |
| 240 | 240 | { |
| 241 | 241 | size_t addr, size, fp, *p = p1; |
| 242 | 242 | |
| @@ -255,7 +255,7 @@ void FASTCALL __bound_local_new(void *p1) · 12 unmodified lines | ||
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /* called when leaving a function to delete all the local regions */ |
| 258 | −void FASTCALL __bound_local_delete(void *p1) | |
| 258 | +void FASTCALL __bound_local_delete(void *p1) | |
| 259 | 259 | { |
| 260 | 260 | size_t addr, fp, *p = p1; |
| 261 | 261 | GET_CALLER_FP(fp); |
| @@ -331,14 +331,14 @@ static void mark_invalid(size_t addr, size_t size) · 69 unmodified lines | ||
| 331 | 331 | #if 0 |
| 332 | 332 | dprintf(stderr, "mark_invalid: start = %x %x\n", t2_start, t2_end); |
| 333 | 333 | #endif |
| 334 | − | |
| 334 | + | |
| 335 | 335 | /* first we handle full pages */ |
| 336 | 336 | t1_start = (t2_start + BOUND_T2_SIZE - 1) >> BOUND_T2_BITS; |
| 337 | 337 | t1_end = t2_end >> BOUND_T2_BITS; |
| 338 | 338 | |
| 339 | 339 | i = t2_start & (BOUND_T2_SIZE - 1); |
| 340 | 340 | j = t2_end & (BOUND_T2_SIZE - 1); |
| 341 | − | |
| 341 | + | |
| 342 | 342 | if (t1_start == t1_end) { |
| 343 | 343 | page = get_page(t2_start >> BOUND_T2_BITS); |
| 344 | 344 | for(; i < j; i++) { |
| @@ -456,7 +456,7 @@ void __bound_main_arg(void **p) · 111 unmodified lines | ||
| 456 | 456 | void *start = p; |
| 457 | 457 | while (*p++); |
| 458 | 458 | |
| 459 | − dprintf(stderr, "%s, %s calling __bound_new_region(%p, %p)\n", | |
| 459 | + dprintf(stderr, "%s, %s calling __bound_new_region(%p, %p)\n", | |
| 460 | 460 | __FILE__, __FUNCTION__, (void *) p - start); |
| 461 | 461 | |
| 462 | 462 | __bound_new_region(start, (void *) p - start); |
| @@ -467,7 +467,7 @@ void __bound_exit(void) · 4 unmodified lines | ||
| 467 | 467 | restore_malloc_hooks(); |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | −static inline void add_region(BoundEntry *e, | |
| 470 | +static inline void add_region(BoundEntry *e, | |
| 471 | 471 | size_t start, size_t size) |
| 472 | 472 | { |
| 473 | 473 | BoundEntry *e1; |
| @@ -496,7 +496,7 @@ void __bound_new_region(void *p, size_t size) · 22 unmodified lines | ||
| 496 | 496 | |
| 497 | 497 | __bound_init(); |
| 498 | 498 | |
| 499 | − dprintf(stderr, "%s, %s(%p, %p) start\n", | |
| 499 | + dprintf(stderr, "%s, %s(%p, %p) start\n", | |
| 500 | 500 | __FILE__, __FUNCTION__, p, size); |
| 501 | 501 | |
| 502 | 502 | start = (size_t)p; |
| @@ -506,9 +506,9 @@ void __bound_new_region(void *p, size_t size) · 3 unmodified lines | ||
| 506 | 506 | |
| 507 | 507 | /* start */ |
| 508 | 508 | page = get_page(t1_start); |
| 509 | − t2_start = (start >> (BOUND_T3_BITS - BOUND_E_BITS)) & | |
| 509 | + t2_start = (start >> (BOUND_T3_BITS - BOUND_E_BITS)) & | |
| 510 | 510 | ((BOUND_T2_SIZE - 1) << BOUND_E_BITS); |
| 511 | − t2_end = (end >> (BOUND_T3_BITS - BOUND_E_BITS)) & | |
| 511 | + t2_end = (end >> (BOUND_T3_BITS - BOUND_E_BITS)) & | |
| 512 | 512 | ((BOUND_T2_SIZE - 1) << BOUND_E_BITS); |
| 513 | 513 | |
| 514 | 514 | |
| @@ -557,7 +557,7 @@ void __bound_new_region(void *p, size_t size) · 42 unmodified lines | ||
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | /* delete a region */ |
| 560 | −static inline void delete_region(BoundEntry *e, | |
| 560 | +static inline void delete_region(BoundEntry *e, | |
| 561 | 561 | void *p, size_t empty_size) |
| 562 | 562 | { |
| 563 | 563 | size_t addr; |
| @@ -612,9 +612,9 @@ int __bound_delete_region(void *p) · 48 unmodified lines | ||
| 612 | 612 | |
| 613 | 613 | start = (size_t)p; |
| 614 | 614 | t1_start = start >> (BOUND_T2_BITS + BOUND_T3_BITS); |
| 615 | − t2_start = (start >> (BOUND_T3_BITS - BOUND_E_BITS)) & | |
| 615 | + t2_start = (start >> (BOUND_T3_BITS - BOUND_E_BITS)) & | |
| 616 | 616 | ((BOUND_T2_SIZE - 1) << BOUND_E_BITS); |
| 617 | − | |
| 617 | + | |
| 618 | 618 | /* find region size */ |
| 619 | 619 | page = __bound_t1[t1_start]; |
| 620 | 620 | e = (BoundEntry *)((char *)page + t2_start); |
| @@ -622,7 +622,7 @@ int __bound_delete_region(void *p) · 1 unmodified line | ||
| 622 | 622 | if (addr > e->size) |
| 623 | 623 | e = __bound_find_region(e, p); |
| 624 | 624 | /* test if invalid region */ |
| 625 | − if (e->size == EMPTY_SIZE || (size_t)p != e->start) | |
| 625 | + if (e->size == EMPTY_SIZE || (size_t)p != e->start) | |
| 626 | 626 | return -1; |
| 627 | 627 | /* compute the size we put in invalid regions */ |
| 628 | 628 | if (e->is_invalid) |
| @@ -634,7 +634,7 @@ int __bound_delete_region(void *p) · 5 unmodified lines | ||
| 634 | 634 | |
| 635 | 635 | /* now we can free each entry */ |
| 636 | 636 | t1_end = end >> (BOUND_T2_BITS + BOUND_T3_BITS); |
| 637 | − t2_end = (end >> (BOUND_T3_BITS - BOUND_E_BITS)) & | |
| 637 | + t2_end = (end >> (BOUND_T3_BITS - BOUND_E_BITS)) & | |
| 638 | 638 | ((BOUND_T2_SIZE - 1) << BOUND_E_BITS); |
| 639 | 639 | |
| 640 | 640 | delete_region(e, p, empty_size); |
| @@ -690,8 +690,8 @@ static size_t get_region_size(void *p) · 49 unmodified lines | ||
| 690 | 690 | BoundEntry *e; |
| 691 | 691 | |
| 692 | 692 | e = __bound_t1[addr >> (BOUND_T2_BITS + BOUND_T3_BITS)]; |
| 693 | − e = (BoundEntry *)((char *)e + | |
| 694 | − ((addr >> (BOUND_T3_BITS - BOUND_E_BITS)) & | |
| 693 | + e = (BoundEntry *)((char *)e + | |
| 694 | + ((addr >> (BOUND_T3_BITS - BOUND_E_BITS)) & | |
| 695 | 695 | ((BOUND_T2_SIZE - 1) << BOUND_E_BITS))); |
| 696 | 696 | addr -= e->start; |
| 697 | 697 | if (addr > e->size) |
| @@ -756,16 +756,16 @@ static void libc_free(void *ptr) · 58 unmodified lines | ||
| 756 | 756 | void *__bound_malloc(size_t size, const void *caller) |
| 757 | 757 | { |
| 758 | 758 | void *ptr; |
| 759 | − | |
| 759 | + | |
| 760 | 760 | /* we allocate one more byte to ensure the regions will be |
| 761 | 761 | separated by at least one byte. With the glibc malloc, it may |
| 762 | 762 | be in fact not necessary */ |
| 763 | 763 | ptr = libc_malloc(size + 1); |
| 764 | − | |
| 764 | + | |
| 765 | 765 | if (!ptr) |
| 766 | 766 | return NULL; |
| 767 | 767 | |
| 768 | − dprintf(stderr, "%s, %s calling __bound_new_region(%p, %p)\n", | |
| 768 | + dprintf(stderr, "%s, %s calling __bound_new_region(%p, %p)\n", | |
| 769 | 769 | __FILE__, __FUNCTION__, ptr, size); |
| 770 | 770 | |
| 771 | 771 | __bound_new_region(ptr, size); |
| @@ -792,13 +792,13 @@ void *__bound_memalign(size_t size, size_t align, const void *caller) · 20 unmodified lines | ||
| 792 | 792 | be in fact not necessary */ |
| 793 | 793 | ptr = memalign(size + 1, align); |
| 794 | 794 | #endif |
| 795 | − | |
| 795 | + | |
| 796 | 796 | install_malloc_hooks(); |
| 797 | − | |
| 797 | + | |
| 798 | 798 | if (!ptr) |
| 799 | 799 | return NULL; |
| 800 | 800 | |
| 801 | − dprintf(stderr, "%s, %s calling __bound_new_region(%p, %p)\n", | |
| 801 | + dprintf(stderr, "%s, %s calling __bound_new_region(%p, %p)\n", | |
| 802 | 802 | __FILE__, __FUNCTION__, ptr, size); |
| 803 | 803 | |
| 804 | 804 | __bound_new_region(ptr, size); |
| @@ -862,8 +862,8 @@ static void bound_dump(void) · 57 unmodified lines | ||
| 862 | 862 | e = page + j; |
| 863 | 863 | /* do not print invalid or empty entries */ |
| 864 | 864 | if (e->size != EMPTY_SIZE && e->start != 0) { |
| 865 | − fprintf(stderr, "%08x:", | |
| 866 | − (i << (BOUND_T2_BITS + BOUND_T3_BITS)) + | |
| 865 | + fprintf(stderr, "%08x:", | |
| 866 | + (i << (BOUND_T2_BITS + BOUND_T3_BITS)) + | |
| 867 | 867 | (j << BOUND_T3_BITS)); |
| 868 | 868 | do { |
| 869 | 869 | fprintf(stderr, " %08lx:%08lx", e->start, e->start + e->size); |
| @@ -1,5 +1,5 @@ | ||
| 1 | −/* TCC runtime library. | |
| 2 | − Parts of this code are (c) 2002 Fabrice Bellard | |
| 1 | +/* TCC runtime library. | |
| 2 | + Parts of this code are (c) 2002 Fabrice Bellard | |
| 3 | 3 | |
| 4 | 4 | Copyright (C) 1987, 1988, 1992, 1994, 1995 Free Software Foundation, Inc. |
| 5 | 5 | |
| @@ -25,7 +25,7 @@ General Public License for more details. · 19 unmodified lines | ||
| 25 | 25 | You should have received a copy of the GNU General Public License |
| 26 | 26 | along with this program; see the file COPYING. If not, write to |
| 27 | 27 | the Free Software Foundation, 59 Temple Place - Suite 330, |
| 28 | −Boston, MA 02111-1307, USA. | |
| 28 | +Boston, MA 02111-1307, USA. | |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | 31 | #include <stdint.h> |
| @@ -370,10 +370,10 @@ long long __divdi3(long long u, long long v) · 338 unmodified lines | ||
| 370 | 370 | int c = 0; |
| 371 | 371 | DWunion uu, vv; |
| 372 | 372 | DWtype w; |
| 373 | − | |
| 373 | + | |
| 374 | 374 | uu.ll = u; |
| 375 | 375 | vv.ll = v; |
| 376 | − | |
| 376 | + | |
| 377 | 377 | if (uu.s.high < 0) { |
| 378 | 378 | c = ~c; |
| 379 | 379 | uu.ll = __negdi2 (uu.ll); |
| @@ -393,17 +393,17 @@ long long __moddi3(long long u, long long v) · 13 unmodified lines | ||
| 393 | 393 | int c = 0; |
| 394 | 394 | DWunion uu, vv; |
| 395 | 395 | DWtype w; |
| 396 | − | |
| 396 | + | |
| 397 | 397 | uu.ll = u; |
| 398 | 398 | vv.ll = v; |
| 399 | − | |
| 399 | + | |
| 400 | 400 | if (uu.s.high < 0) { |
| 401 | 401 | c = ~c; |
| 402 | 402 | uu.ll = __negdi2 (uu.ll); |
| 403 | 403 | } |
| 404 | 404 | if (vv.s.high < 0) |
| 405 | 405 | vv.ll = __negdi2 (vv.ll); |
| 406 | − | |
| 406 | + | |
| 407 | 407 | __udivmoddi4 (uu.ll, vv.ll, (UDWtype *) &w); |
| 408 | 408 | if (c) |
| 409 | 409 | w = __negdi2 (w); |
| @@ -418,7 +418,7 @@ unsigned long long __udivdi3(unsigned long long u, unsigned long long v) · 8 unmodified lines | ||
| 418 | 418 | unsigned long long __umoddi3(unsigned long long u, unsigned long long v) |
| 419 | 419 | { |
| 420 | 420 | UDWtype w; |
| 421 | − | |
| 421 | + | |
| 422 | 422 | __udivmoddi4 (u, v, &w); |
| 423 | 423 | return w; |
| 424 | 424 | } |
| @@ -499,7 +499,7 @@ long long __tcc_cvt_ftol(long double x) · 74 unmodified lines | ||
| 499 | 499 | /* XXX: fix tcc's code generator to do this instead */ |
| 500 | 500 | float __floatundisf(unsigned long long a) |
| 501 | 501 | { |
| 502 | − DWunion uu; | |
| 502 | + DWunion uu; | |
| 503 | 503 | XFtype r; |
| 504 | 504 | |
| 505 | 505 | uu.ll = a; |
| @@ -514,7 +514,7 @@ float __floatundisf(unsigned long long a) · 8 unmodified lines | ||
| 514 | 514 | |
| 515 | 515 | double __floatundidf(unsigned long long a) |
| 516 | 516 | { |
| 517 | − DWunion uu; | |
| 517 | + DWunion uu; | |
| 518 | 518 | XFtype r; |
| 519 | 519 | |
| 520 | 520 | uu.ll = a; |
| @@ -529,7 +529,7 @@ double __floatundidf(unsigned long long a) · 8 unmodified lines | ||
| 529 | 529 | |
| 530 | 530 | long double __floatundixf(unsigned long long a) |
| 531 | 531 | { |
| 532 | − DWunion uu; | |
| 532 | + DWunion uu; | |
| 533 | 533 | XFtype r; |
| 534 | 534 | |
| 535 | 535 | uu.ll = a; |
| @@ -608,7 +608,7 @@ unsigned long long __fixunsxfdi (long double a1) · 72 unmodified lines | ||
| 608 | 608 | |
| 609 | 609 | if (exp > 0) |
| 610 | 610 | return (unsigned long long)-1; |
| 611 | − else if (exp >= -63) | |
| 611 | + else if (exp >= -63) | |
| 612 | 612 | return l >> -exp; |
| 613 | 613 | else |
| 614 | 614 | return 0; |
| @@ -318,7 +318,7 @@ PUB_FUNC void tcc_free_debug(void *ptr) · 317 unmodified lines | ||
| 318 | 318 | |
| 319 | 319 | mem_cur_size -= header->size; |
| 320 | 320 | header->size = (size_t)-1; |
| 321 | − | |
| 321 | + | |
| 322 | 322 | if (header->next) |
| 323 | 323 | header->next->prev = header->prev; |
| 324 | 324 | |
| @@ -99,9 +99,9 @@ the @code{main()} of a.c. · 98 unmodified lines | ||
| 99 | 99 | |
| 100 | 100 | @item @samp{tcc a.c -run b.c arg1} |
| 101 | 101 | Compile @file{a.c} and @file{b.c}, link them together and execute them. arg1 is given |
| 102 | −as first argument to the @code{main()} of the resulting program. | |
| 103 | −@ignore | |
| 104 | −Because multiple C files are specified, @option{--} are necessary to clearly | |
| 102 | +as first argument to the @code{main()} of the resulting program. | |
| 103 | +@ignore | |
| 104 | +Because multiple C files are specified, @option{--} are necessary to clearly | |
| 105 | 105 | separate the program arguments from the TCC options. |
| 106 | 106 | @end ignore |
| 107 | 107 | |
| @@ -136,14 +136,14 @@ need to add @code{#!/usr/local/bin/tcc -run} at the start of your C source: · 28 unmodified lines | ||
| 136 | 136 | #!/usr/local/bin/tcc -run |
| 137 | 137 | #include <stdio.h> |
| 138 | 138 | |
| 139 | −int main() | |
| 139 | +int main() | |
| 140 | 140 | @{ |
| 141 | 141 | printf("Hello World\n"); |
| 142 | 142 | return 0; |
| 143 | 143 | @} |
| 144 | 144 | @end example |
| 145 | 145 | |
| 146 | −TCC can read C source code from @emph{standard input} when @option{-} is used in | |
| 146 | +TCC can read C source code from @emph{standard input} when @option{-} is used in | |
| 147 | 147 | place of @option{infile}. Example: |
| 148 | 148 | |
| 149 | 149 | @example |
| @@ -271,7 +271,7 @@ Make string constants be of type @code{const char *} instead of @code{char · 121 unmodified lines | ||
| 271 | 271 | @item -Werror |
| 272 | 272 | Abort compilation if warnings are issued. |
| 273 | 273 | |
| 274 | −@item -Wall | |
| 274 | +@item -Wall | |
| 275 | 275 | Activate all warnings, except @option{-Werror}, @option{-Wunusupported} and |
| 276 | 276 | @option{-Wwrite-strings}. |
| 277 | 277 | |
| @@ -451,7 +451,7 @@ function name. · 173 unmodified lines | ||
| 451 | 451 | |
| 452 | 452 | int tab[10] = @{ 1, 2, [5] = 5, [9] = 9@}; |
| 453 | 453 | @end example |
| 454 | − | |
| 454 | + | |
| 455 | 455 | @item Compound initializers are supported: |
| 456 | 456 | @example |
| 457 | 457 | int *p = (int [])@{ 1, 2, 3 @}; |
| @@ -465,7 +465,7 @@ works for structures and strings. · 7 unmodified lines | ||
| 465 | 465 | @end example |
| 466 | 466 | |
| 467 | 467 | @noindent |
| 468 | −is the same as writing | |
| 468 | +is the same as writing | |
| 469 | 469 | @example |
| 470 | 470 | double d = 4771840.0; |
| 471 | 471 | @end example |
| @@ -481,12 +481,12 @@ TCC implements some GNU C extensions: · 9 unmodified lines | ||
| 481 | 481 | |
| 482 | 482 | @itemize |
| 483 | 483 | |
| 484 | −@item array designators can be used without '=': | |
| 484 | +@item array designators can be used without '=': | |
| 485 | 485 | @example |
| 486 | 486 | int a[10] = @{ [0] 1, [5] 2, 3, 4 @}; |
| 487 | 487 | @end example |
| 488 | 488 | |
| 489 | −@item Structure field designators can be a label: | |
| 489 | +@item Structure field designators can be a label: | |
| 490 | 490 | @example |
| 491 | 491 | struct @{ int x, y; @} st = @{ x: 1, y: 1@}; |
| 492 | 492 | @end example |
| @@ -555,7 +555,7 @@ Here are some examples: · 62 unmodified lines | ||
| 555 | 555 | align variable @code{a} to 8 bytes and put it in section @code{.mysection}. |
| 556 | 556 | |
| 557 | 557 | @example |
| 558 | − int my_add(int a, int b) __attribute__ ((section(".mycodesection"))) | |
| 558 | + int my_add(int a, int b) __attribute__ ((section(".mycodesection"))) | |
| 559 | 559 | @{ |
| 560 | 560 | return a + b; |
| 561 | 561 | @} |
| @@ -572,17 +572,17 @@ generate function @code{my_add} in section @code{.mycodesection}. · 10 unmodified lines | ||
| 572 | 572 | dprintf("one arg %d\n", 1); |
| 573 | 573 | @end example |
| 574 | 574 | |
| 575 | −@item @code{__FUNCTION__} is interpreted as C99 @code{__func__} | |
| 575 | +@item @code{__FUNCTION__} is interpreted as C99 @code{__func__} | |
| 576 | 576 | (so it has not exactly the same semantics as string literal GNUC |
| 577 | 577 | where it is a string literal). |
| 578 | 578 | |
| 579 | −@item The @code{__alignof__} keyword can be used as @code{sizeof} | |
| 579 | +@item The @code{__alignof__} keyword can be used as @code{sizeof} | |
| 580 | 580 | to get the alignment of a type or an expression. |
| 581 | 581 | |
| 582 | −@item The @code{typeof(x)} returns the type of @code{x}. | |
| 582 | +@item The @code{typeof(x)} returns the type of @code{x}. | |
| 583 | 583 | @code{x} is an expression or a type. |
| 584 | 584 | |
| 585 | −@item Computed gotos: @code{&&label} returns a pointer of type | |
| 585 | +@item Computed gotos: @code{&&label} returns a pointer of type | |
| 586 | 586 | @code{void *} on the goto label @code{label}. @code{goto *expr} can be |
| 587 | 587 | used to jump on the pointer resulting from @code{expr}. |
| 588 | 588 | |
| @@ -616,7 +616,7 @@ TCC includes its own x86 inline assembler with a @code{gas}-like (GNU · 27 unmodified lines | ||
| 616 | 616 | assembler) syntax. No intermediate files are generated. GCC 3.x named |
| 617 | 617 | operands are supported. |
| 618 | 618 | |
| 619 | −@item @code{__builtin_types_compatible_p()} and @code{__builtin_constant_p()} | |
| 619 | +@item @code{__builtin_types_compatible_p()} and @code{__builtin_constant_p()} | |
| 620 | 620 | are supported. |
| 621 | 621 | |
| 622 | 622 | @item @code{#pragma pack} is supported for win32 compatibility. |
| @@ -681,7 +681,7 @@ same as C. · 58 unmodified lines | ||
| 681 | 681 | @item +, - |
| 682 | 682 | @end enumerate |
| 683 | 683 | |
| 684 | −@item A value is either an absolute number or a label plus an offset. | |
| 684 | +@item A value is either an absolute number or a label plus an offset. | |
| 685 | 685 | All operators accept absolute values except '+' and '-'. '+' or '-' can be |
| 686 | 686 | used to add an offset to a label. '-' supports two labels only if they |
| 687 | 687 | are the same or if they are both defined and in the same section. |
| @@ -694,7 +694,7 @@ are the same or if they are both defined and in the same section. · 6 unmodified lines | ||
| 694 | 694 | |
| 695 | 695 | @item All labels are considered as local, except undefined ones. |
| 696 | 696 | |
| 697 | −@item Numeric labels can be used as local @code{gas}-like labels. | |
| 697 | +@item Numeric labels can be used as local @code{gas}-like labels. | |
| 698 | 698 | They can be defined several times in the same source. Use 'b' |
| 699 | 699 | (backward) or 'f' (forward) as suffix to reference them: |
| 700 | 700 | |
| @@ -901,7 +901,7 @@ Here are some examples of caught errors: · 200 unmodified lines | ||
| 901 | 901 | @chapter The @code{libtcc} library |
| 902 | 902 | |
| 903 | 903 | The @code{libtcc} library enables you to use TCC as a backend for |
| 904 | −dynamic code generation. | |
| 904 | +dynamic code generation. | |
| 905 | 905 | |
| 906 | 906 | Read the @file{libtcc.h} to have an overview of the API. Read |
| 907 | 907 | @file{libtcc_test.c} to have a very simple example. |
| @@ -941,10 +941,10 @@ except: · 33 unmodified lines | ||
| 941 | 941 | |
| 942 | 942 | @itemize |
| 943 | 943 | |
| 944 | −@item For initialized arrays with unknown size, a first pass | |
| 944 | +@item For initialized arrays with unknown size, a first pass | |
| 945 | 945 | is done to count the number of elements. |
| 946 | 946 | |
| 947 | −@item For architectures where arguments are evaluated in | |
| 947 | +@item For architectures where arguments are evaluated in | |
| 948 | 948 | reverse order, a first pass is done to reverse the argument order. |
| 949 | 949 | |
| 950 | 950 | @end itemize |
| @@ -1156,7 +1156,7 @@ stack. · 205 unmodified lines | ||
| 1156 | 1156 | @item VT_CMP |
| 1157 | 1157 | indicates that the value is actually stored in the CPU flags (i.e. the |
| 1158 | 1158 | value is the consequence of a test). The value is either 0 or 1. The |
| 1159 | −actual CPU flags used is indicated in @code{SValue.c.i}. | |
| 1159 | +actual CPU flags used is indicated in @code{SValue.c.i}. | |
| 1160 | 1160 | |
| 1161 | 1161 | If any code is generated which destroys the CPU flags, this value MUST be |
| 1162 | 1162 | put in a normal register. |
| @@ -1176,7 +1176,7 @@ taken. · 13 unmodified lines | ||
| 1176 | 1176 | @item VT_LVAL |
| 1177 | 1177 | is a flag indicating that the value is actually an lvalue (left value of |
| 1178 | 1178 | an assignment). It means that the value stored is actually a pointer to |
| 1179 | −the wanted value. | |
| 1179 | +the wanted value. | |
| 1180 | 1180 | |
| 1181 | 1181 | Understanding the use @code{VT_LVAL} is very important if you want to |
| 1182 | 1182 | understand how TCC works. |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * TCC - Tiny C Compiler |
| 3 | − * | |
| 3 | + * | |
| 4 | 4 | * Copyright (c) 2001-2004 Fabrice Bellard |
| 5 | 5 | * |
| 6 | 6 | * This library is free software; you can redistribute it and/or |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * TCC - Tiny C Compiler |
| 3 | − * | |
| 3 | + * | |
| 4 | 4 | * Copyright (c) 2001-2004 Fabrice Bellard |
| 5 | 5 | * |
| 6 | 6 | * This library is free software; you can redistribute it and/or |
| @@ -605,7 +605,7 @@ struct TCCState { · 598 unmodified lines | ||
| 605 | 605 | int old_struct_init_code; /* use old algorithm to init array in struct when there is no '{' used. |
| 606 | 606 | Liuux 2.4.26 can't find initrd when compiled with a new algorithm */ |
| 607 | 607 | int dollars_in_identifiers; /* allows '$' char in indentifiers */ |
| 608 | − | |
| 608 | + | |
| 609 | 609 | /* warning switches */ |
| 610 | 610 | int warn_write_strings; |
| 611 | 611 | int warn_unsupported; |
| @@ -631,7 +631,7 @@ struct TCCState { · 19 unmodified lines | ||
| 631 | 631 | |
| 632 | 632 | char *init_symbol; /* symbols to call at load-time (not used currently) */ |
| 633 | 633 | char *fini_symbol; /* symbols to call at unload-time (not used currently) */ |
| 634 | − | |
| 634 | + | |
| 635 | 635 | #ifdef TCC_TARGET_I386 |
| 636 | 636 | int seg_size; /* 32. Can be 16 with i386 assembler (.code16) */ |
| 637 | 637 | #endif |
| @@ -885,7 +885,7 @@ struct TCCState { · 247 unmodified lines | ||
| 885 | 885 | |
| 886 | 886 | #define TOK_SHL 0x01 /* shift left */ |
| 887 | 887 | #define TOK_SAR 0x02 /* signed shift right */ |
| 888 | − | |
| 888 | + | |
| 889 | 889 | /* assignement operators : normal operator or 0x80 */ |
| 890 | 890 | #define TOK_A_MOD 0xa5 |
| 891 | 891 | #define TOK_A_AND 0xa6 |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * GAS like assembler for TCC |
| 3 | − * | |
| 3 | + * | |
| 4 | 4 | * Copyright (c) 2001-2004 Fabrice Bellard |
| 5 | 5 | * |
| 6 | 6 | * This library is free software; you can redistribute it and/or |
| @@ -125,7 +125,7 @@ static void asm_expr_unary(TCCState *s1, ExprValue *pe) · 118 unmodified lines | ||
| 125 | 125 | break; |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | − | |
| 128 | + | |
| 129 | 129 | static void asm_expr_prod(TCCState *s1, ExprValue *pe) |
| 130 | 130 | { |
| 131 | 131 | int op; |
| @@ -134,7 +134,7 @@ static void asm_expr_prod(TCCState *s1, ExprValue *pe) · 2 unmodified lines | ||
| 134 | 134 | asm_expr_unary(s1, pe); |
| 135 | 135 | for(;;) { |
| 136 | 136 | op = tok; |
| 137 | − if (op != '*' && op != '/' && op != '%' && | |
| 137 | + if (op != '*' && op != '/' && op != '%' && | |
| 138 | 138 | op != TOK_SHL && op != TOK_SAR) |
| 139 | 139 | break; |
| 140 | 140 | next(); |
| @@ -145,14 +145,14 @@ static void asm_expr_prod(TCCState *s1, ExprValue *pe) · 4 unmodified lines | ||
| 145 | 145 | case '*': |
| 146 | 146 | pe->v *= e2.v; |
| 147 | 147 | break; |
| 148 | − case '/': | |
| 148 | + case '/': | |
| 149 | 149 | if (e2.v == 0) { |
| 150 | 150 | div_error: |
| 151 | 151 | tcc_error("division by zero"); |
| 152 | 152 | } |
| 153 | 153 | pe->v /= e2.v; |
| 154 | 154 | break; |
| 155 | − case '%': | |
| 155 | + case '%': | |
| 156 | 156 | if (e2.v == 0) |
| 157 | 157 | goto div_error; |
| 158 | 158 | pe->v %= e2.v; |
| @@ -186,7 +186,7 @@ static void asm_expr_logic(TCCState *s1, ExprValue *pe) · 27 unmodified lines | ||
| 186 | 186 | case '&': |
| 187 | 187 | pe->v &= e2.v; |
| 188 | 188 | break; |
| 189 | − case '|': | |
| 189 | + case '|': | |
| 190 | 190 | pe->v |= e2.v; |
| 191 | 191 | break; |
| 192 | 192 | default: |
| @@ -224,7 +224,7 @@ static inline void asm_expr_sum(TCCState *s1, ExprValue *pe) · 31 unmodified lines | ||
| 224 | 224 | } else if (pe->sym && !e2.sym) { |
| 225 | 225 | /* OK */ |
| 226 | 226 | } else if (pe->sym && e2.sym) { |
| 227 | − if (pe->sym == e2.sym) { | |
| 227 | + if (pe->sym == e2.sym) { | |
| 228 | 228 | /* OK */ |
| 229 | 229 | } else if (pe->sym->r == e2.sym->r && pe->sym->r != 0) { |
| 230 | 230 | /* we also accept defined symbols in the same section */ |
| @@ -267,7 +267,7 @@ static void asm_new_label1(TCCState *s1, int label, int is_local, · 36 unmodified lines | ||
| 267 | 267 | if (sym->r) { |
| 268 | 268 | /* the label is already defined */ |
| 269 | 269 | if (!is_local) { |
| 270 | − tcc_error("assembler label '%s' already defined", | |
| 270 | + tcc_error("assembler label '%s' already defined", | |
| 271 | 271 | get_tok_str(label, NULL)); |
| 272 | 272 | } else { |
| 273 | 273 | /* redefinition of local labels is possible */ |
| @@ -493,7 +493,7 @@ static void asm_parse_directive(TCCState *s1) · 219 unmodified lines | ||
| 493 | 493 | case TOK_ASM_weak: |
| 494 | 494 | case TOK_ASM_hidden: |
| 495 | 495 | tok1 = tok; |
| 496 | − do { | |
| 496 | + do { | |
| 497 | 497 | Sym *sym; |
| 498 | 498 | |
| 499 | 499 | next(); |
| @@ -541,7 +541,7 @@ static void asm_parse_directive(TCCState *s1) · 41 unmodified lines | ||
| 541 | 541 | case TOK_ASM_text: |
| 542 | 542 | case TOK_ASM_data: |
| 543 | 543 | case TOK_ASM_bss: |
| 544 | − { | |
| 544 | + { | |
| 545 | 545 | char sname[64]; |
| 546 | 546 | tok1 = tok; |
| 547 | 547 | n = 0; |
| @@ -591,7 +591,7 @@ static void asm_parse_directive(TCCState *s1) · 43 unmodified lines | ||
| 591 | 591 | } |
| 592 | 592 | break; |
| 593 | 593 | case TOK_ASM_size: |
| 594 | − { | |
| 594 | + { | |
| 595 | 595 | Sym *sym; |
| 596 | 596 | |
| 597 | 597 | next(); |
| @@ -612,7 +612,7 @@ static void asm_parse_directive(TCCState *s1) · 14 unmodified lines | ||
| 612 | 612 | } |
| 613 | 613 | break; |
| 614 | 614 | case TOK_ASM_type: |
| 615 | − { | |
| 615 | + { | |
| 616 | 616 | Sym *sym; |
| 617 | 617 | const char *newtype; |
| 618 | 618 | |
| @@ -637,7 +637,7 @@ static void asm_parse_directive(TCCState *s1) · 18 unmodified lines | ||
| 637 | 637 | sym->type.t = (sym->type.t & ~VT_BTYPE) | VT_FUNC; |
| 638 | 638 | } |
| 639 | 639 | else if (s1->warn_unsupported) |
| 640 | − tcc_warning("change type of '%s' from 0x%x to '%s' ignored", | |
| 640 | + tcc_warning("change type of '%s' from 0x%x to '%s' ignored", | |
| 641 | 641 | get_tok_str(sym->v, NULL), sym->type.t, newtype); |
| 642 | 642 | |
| 643 | 643 | next(); |
| @@ -669,7 +669,7 @@ static void asm_parse_directive(TCCState *s1) · 25 unmodified lines | ||
| 669 | 669 | } |
| 670 | 670 | break; |
| 671 | 671 | case TOK_ASM_previous: |
| 672 | − { | |
| 672 | + { | |
| 673 | 673 | Section *sec; |
| 674 | 674 | next(); |
| 675 | 675 | if (!last_text_section) |
| @@ -830,7 +830,7 @@ ST_FUNC int tcc_assemble(TCCState *s1, int do_preprocess) · 154 unmodified lines | ||
| 830 | 830 | |
| 831 | 831 | cur_text_section->data_offset = ind; |
| 832 | 832 | |
| 833 | − free_defines(define_start); | |
| 833 | + free_defines(define_start); | |
| 834 | 834 | |
| 835 | 835 | return ret; |
| 836 | 836 | } |
| @@ -863,7 +863,7 @@ static void tcc_assemble_inline(TCCState *s1, char *str, int len) · 26 unmodified lines | ||
| 863 | 863 | /* find a constraint by its number or id (gcc 3 extended |
| 864 | 864 | syntax). return -1 if not found. Return in *pp in char after the |
| 865 | 865 | constraint */ |
| 866 | −ST_FUNC int find_constraint(ASMOperand *operands, int nb_operands, | |
| 866 | +ST_FUNC int find_constraint(ASMOperand *operands, int nb_operands, | |
| 867 | 867 | const char *name, const char **pp) |
| 868 | 868 | { |
| 869 | 869 | int index; |
| @@ -901,7 +901,7 @@ ST_FUNC int find_constraint(ASMOperand *operands, int nb_operands, · 31 unmodified lines | ||
| 901 | 901 | return index; |
| 902 | 902 | } |
| 903 | 903 | |
| 904 | −static void subst_asm_operands(ASMOperand *operands, int nb_operands, | |
| 904 | +static void subst_asm_operands(ASMOperand *operands, int nb_operands, | |
| 905 | 905 | int nb_outputs, |
| 906 | 906 | CString *out_str, CString *in_str) |
| 907 | 907 | { |
| @@ -1052,12 +1052,12 @@ ST_FUNC void asm_instr(void) · 144 unmodified lines | ||
| 1052 | 1052 | token after the assembler parsing */ |
| 1053 | 1053 | if (tok != ';') |
| 1054 | 1054 | expect("';'"); |
| 1055 | − | |
| 1055 | + | |
| 1056 | 1056 | /* save all values in the memory */ |
| 1057 | 1057 | save_regs(0); |
| 1058 | 1058 | |
| 1059 | 1059 | /* compute constraints */ |
| 1060 | − asm_compute_constraints(operands, nb_operands, nb_outputs, | |
| 1060 | + asm_compute_constraints(operands, nb_operands, nb_outputs, | |
| 1061 | 1061 | clobber_regs, &out_reg); |
| 1062 | 1062 | |
| 1063 | 1063 | /* substitute the operands in the asm string. No substitution is |
| @@ -1076,8 +1076,8 @@ ST_FUNC void asm_instr(void) · 12 unmodified lines | ||
| 1076 | 1076 | #endif |
| 1077 | 1077 | |
| 1078 | 1078 | /* generate loads */ |
| 1079 | − asm_gen_code(operands, nb_operands, nb_outputs, 0, | |
| 1080 | − clobber_regs, out_reg); | |
| 1079 | + asm_gen_code(operands, nb_operands, nb_outputs, 0, | |
| 1080 | + clobber_regs, out_reg); | |
| 1081 | 1081 | |
| 1082 | 1082 | /* assemble the string with tcc internal assembler */ |
| 1083 | 1083 | tcc_assemble_inline(tcc_state, astr1.data, astr1.size - 1); |
| @@ -1086,9 +1086,9 @@ ST_FUNC void asm_instr(void) · 2 unmodified lines | ||
| 1086 | 1086 | next(); |
| 1087 | 1087 | |
| 1088 | 1088 | /* store the output values if needed */ |
| 1089 | − asm_gen_code(operands, nb_operands, nb_outputs, 1, | |
| 1089 | + asm_gen_code(operands, nb_operands, nb_outputs, 1, | |
| 1090 | 1090 | clobber_regs, out_reg); |
| 1091 | − | |
| 1091 | + | |
| 1092 | 1092 | /* free everything */ |
| 1093 | 1093 | for(i=0;i<nb_operands;i++) { |
| 1094 | 1094 | ASMOperand *op; |
| @@ -1110,7 +1110,7 @@ ST_FUNC void asm_global_instr(void) · 15 unmodified lines | ||
| 1110 | 1110 | token after the assembler parsing */ |
| 1111 | 1111 | if (tok != ';') |
| 1112 | 1112 | expect("';'"); |
| 1113 | − | |
| 1113 | + | |
| 1114 | 1114 | #ifdef ASM_DEBUG |
| 1115 | 1115 | printf("asm_global: \"%s\"\n", (char *)astr.data); |
| 1116 | 1116 | #endif |
| @@ -1119,7 +1119,7 @@ ST_FUNC void asm_global_instr(void) · 2 unmodified lines | ||
| 1119 | 1119 | |
| 1120 | 1120 | /* assemble the string with tcc internal assembler */ |
| 1121 | 1121 | tcc_assemble_inline(tcc_state, astr.data, astr.size - 1); |
| 1122 | − | |
| 1122 | + | |
| 1123 | 1123 | cur_text_section->data_offset = ind; |
| 1124 | 1124 | |
| 1125 | 1125 | /* restore the current C token */ |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * COFF file handling for TCC |
| 3 | − * | |
| 3 | + * | |
| 4 | 4 | * Copyright (c) 2003, 2004 TK |
| 5 | 5 | * Copyright (c) 2004 Fabrice Bellard |
| 6 | 6 | * |
| @@ -606,7 +606,7 @@ ST_FUNC int tcc_output_coff(TCCState *s1, FILE *f) · 599 unmodified lines | ||
| 606 | 606 | // put a .ef |
| 607 | 607 | |
| 608 | 608 | strcpy(csym._n._n_name, ".ef"); |
| 609 | − csym.n_value = EndAddress[k]; // physical address | |
| 609 | + csym.n_value = EndAddress[k]; // physical address | |
| 610 | 610 | csym.n_scnum = CoffTextSectionNo; |
| 611 | 611 | csym.n_type = 0; |
| 612 | 612 | csym.n_sclass = C_FCN; |
| @@ -1179,7 +1179,7 @@ static unsigned long put_got_entry(TCCState *s1, · 1178 unmodified lines | ||
| 1179 | 1179 | p[11] = 0xe9; /* jmp plt_start */ |
| 1180 | 1180 | put32(p + 12, -(plt->data_offset)); |
| 1181 | 1181 | |
| 1182 | − /* If this was an UNDEF symbol set the offset in the | |
| 1182 | + /* If this was an UNDEF symbol set the offset in the | |
| 1183 | 1183 | dynsymtab to the PLT slot, so that PC32 relocs to it |
| 1184 | 1184 | can be resolved. */ |
| 1185 | 1185 | if (sym->st_shndx == SHN_UNDEF) |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * TCC - Tiny C Compiler |
| 3 | − * | |
| 3 | + * | |
| 4 | 4 | * Copyright (c) 2001-2004 Fabrice Bellard |
| 5 | 5 | * |
| 6 | 6 | * This library is free software; you can redistribute it and/or |
| @@ -299,7 +299,7 @@ static void weaken_symbol(Sym *sym) · 292 unmodified lines | ||
| 299 | 299 | if (sym->c > 0) { |
| 300 | 300 | int esym_type; |
| 301 | 301 | ElfW(Sym) *esym; |
| 302 | − | |
| 302 | + | |
| 303 | 303 | esym = &((ElfW(Sym) *)symtab_section->data)[sym->c]; |
| 304 | 304 | esym_type = ELFW(ST_TYPE)(esym->st_info); |
| 305 | 305 | esym->st_info = ELFW(ST_INFO)(STB_WEAK, esym_type); |
| @@ -321,7 +321,7 @@ static void apply_visibility(Sym *sym, CType *type) · 15 unmodified lines | ||
| 321 | 321 | |
| 322 | 322 | if (sym->c > 0) { |
| 323 | 323 | ElfW(Sym) *esym; |
| 324 | − | |
| 324 | + | |
| 325 | 325 | esym = &((ElfW(Sym) *)symtab_section->data)[sym->c]; |
| 326 | 326 | vis >>= VT_VIS_SHIFT; |
| 327 | 327 | esym->st_other = (esym->st_other & ~ELFW(ST_VISIBILITY)(-1)) | vis; |
| @@ -425,7 +425,7 @@ ST_FUNC Sym *get_sym_ref(CType *type, Section *sec, unsigned long offset, unsign · 97 unmodified lines | ||
| 425 | 425 | /* push a reference to a section offset by adding a dummy symbol */ |
| 426 | 426 | static void vpush_ref(CType *type, Section *sec, unsigned long offset, unsigned long size) |
| 427 | 427 | { |
| 428 | − vpushsym(type, get_sym_ref(type, sec, offset, size)); | |
| 428 | + vpushsym(type, get_sym_ref(type, sec, offset, size)); | |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | /* define a new external reference to a symbol 'v' of type 'u' */ |
| @@ -461,7 +461,7 @@ static Sym *external_sym(int v, CType *type, int r, char *asm_label) · 29 unmodified lines | ||
| 461 | 461 | s->r = r | VT_CONST | VT_SYM; |
| 462 | 462 | s->type.t |= VT_EXTERN; |
| 463 | 463 | } else if (!is_compatible_types(&s->type, type)) { |
| 464 | − tcc_error("incompatible types for redefinition of '%s'", | |
| 464 | + tcc_error("incompatible types for redefinition of '%s'", | |
| 465 | 465 | get_tok_str(v, NULL)); |
| 466 | 466 | } |
| 467 | 467 | /* Merge some storage attributes. */ |
| @@ -600,7 +600,7 @@ ST_FUNC int get_reg_ex(int rc, int rc2) · 132 unmodified lines | ||
| 600 | 600 | { |
| 601 | 601 | int r; |
| 602 | 602 | SValue *p; |
| 603 | − | |
| 603 | + | |
| 604 | 604 | for(r=0;r<NB_REGS;r++) { |
| 605 | 605 | if (reg_classes[r] & rc2) { |
| 606 | 606 | int n; |
| @@ -636,7 +636,7 @@ ST_FUNC int get_reg(int rc) · 29 unmodified lines | ||
| 636 | 636 | } |
| 637 | 637 | notfound: ; |
| 638 | 638 | } |
| 639 | − | |
| 639 | + | |
| 640 | 640 | /* no register left : free the first one on the stack (VERY |
| 641 | 641 | IMPORTANT to start from the bottom to ensure that we don't |
| 642 | 642 | spill registers used in gen_opi()) */ |
| @@ -761,7 +761,7 @@ ST_FUNC int gv(int rc) · 118 unmodified lines | ||
| 761 | 761 | gen_op(TOK_SAR); |
| 762 | 762 | r = gv(rc); |
| 763 | 763 | } else { |
| 764 | − if (is_float(vtop->type.t) && | |
| 764 | + if (is_float(vtop->type.t) && | |
| 765 | 765 | (vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) { |
| 766 | 766 | Sym *sym; |
| 767 | 767 | int *ptr; |
| @@ -769,7 +769,7 @@ ST_FUNC int gv(int rc) · 1 unmodified line | ||
| 769 | 769 | #if defined(TCC_TARGET_ARM) && !defined(TCC_ARM_VFP) |
| 770 | 770 | CValue check; |
| 771 | 771 | #endif |
| 772 | − | |
| 772 | + | |
| 773 | 773 | /* XXX: unify with initializers handling ? */ |
| 774 | 774 | /* CPUs usually cannot use float constants, so we store them |
| 775 | 775 | generically in data segment */ |
| @@ -803,7 +803,7 @@ ST_FUNC int gv(int rc) · 27 unmodified lines | ||
| 803 | 803 | vtop->c.ptr_offset = 0; |
| 804 | 804 | } |
| 805 | 805 | #ifdef CONFIG_TCC_BCHECK |
| 806 | − if (vtop->r & VT_MUSTBOUND) | |
| 806 | + if (vtop->r & VT_MUSTBOUND) | |
| 807 | 807 | gbound(); |
| 808 | 808 | #endif |
| 809 | 809 | |
| @@ -921,7 +921,7 @@ ST_FUNC int gv(int rc) · 111 unmodified lines | ||
| 921 | 921 | vtop->r = r; |
| 922 | 922 | #ifdef TCC_TARGET_C67 |
| 923 | 923 | /* uses register pairs for doubles */ |
| 924 | − if ((vtop->type.t & VT_BTYPE) == VT_DOUBLE) | |
| 924 | + if ((vtop->type.t & VT_BTYPE) == VT_DOUBLE) | |
| 925 | 925 | vtop->r2 = r+1; |
| 926 | 926 | #endif |
| 927 | 927 | } |
| @@ -1036,7 +1036,7 @@ static void lbuild(int t) · 108 unmodified lines | ||
| 1036 | 1036 | vpop(); |
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | −/* rotate n first stack elements to the bottom | |
| 1039 | +/* rotate n first stack elements to the bottom | |
| 1040 | 1040 | I1 ... In -> I2 ... In I1 [top is right] |
| 1041 | 1041 | */ |
| 1042 | 1042 | ST_FUNC void vrotb(int n) |
| @@ -1476,7 +1476,7 @@ static void gen_opic(int op) · 433 unmodified lines | ||
| 1476 | 1476 | vtop--; |
| 1477 | 1477 | } else { |
| 1478 | 1478 | /* if commutative ops, put c2 as constant */ |
| 1479 | − if (c1 && (op == '+' || op == '&' || op == '^' || | |
| 1479 | + if (c1 && (op == '+' || op == '&' || op == '^' || | |
| 1480 | 1480 | op == '|' || op == '*')) { |
| 1481 | 1481 | vswap(); |
| 1482 | 1482 | c2 = c1; //c = c1, c1 = c2, c2 = c; |
| @@ -1582,13 +1582,13 @@ static void gen_opif(int op) · 99 unmodified lines | ||
| 1582 | 1582 | case '+': f1 += f2; break; |
| 1583 | 1583 | case '-': f1 -= f2; break; |
| 1584 | 1584 | case '*': f1 *= f2; break; |
| 1585 | − case '/': | |
| 1585 | + case '/': | |
| 1586 | 1586 | if (f2 == 0.0) { |
| 1587 | 1587 | if (const_wanted) |
| 1588 | 1588 | tcc_error("division by zero in constant"); |
| 1589 | 1589 | goto general_case; |
| 1590 | 1590 | } |
| 1591 | − f1 /= f2; | |
| 1591 | + f1 /= f2; | |
| 1592 | 1592 | break; |
| 1593 | 1593 | /* XXX: also handles tests ? */ |
| 1594 | 1594 | default: |
| @@ -1636,7 +1636,7 @@ static inline int is_null_pointer(SValue *p) · 41 unmodified lines | ||
| 1636 | 1636 | |
| 1637 | 1637 | static inline int is_integer_btype(int bt) |
| 1638 | 1638 | { |
| 1639 | − return (bt == VT_BYTE || bt == VT_SHORT || | |
| 1639 | + return (bt == VT_BYTE || bt == VT_SHORT || | |
| 1640 | 1640 | bt == VT_INT || bt == VT_LLONG); |
| 1641 | 1641 | } |
| 1642 | 1642 | |
| @@ -1645,7 +1645,7 @@ static void check_comparison_pointer_types(SValue *p1, SValue *p2, int op) · 2 unmodified lines | ||
| 1645 | 1645 | { |
| 1646 | 1646 | CType *type1, *type2, tmp_type1, tmp_type2; |
| 1647 | 1647 | int bt1, bt2; |
| 1648 | − | |
| 1648 | + | |
| 1649 | 1649 | /* null pointers are accepted for all comparisons as gcc */ |
| 1650 | 1650 | if (is_null_pointer(p1) || is_null_pointer(p2)) |
| 1651 | 1651 | return; |
| @@ -1663,16 +1663,16 @@ static void check_comparison_pointer_types(SValue *p1, SValue *p2, int op) · 11 unmodified lines | ||
| 1663 | 1663 | /* both must be pointers or implicit function pointers */ |
| 1664 | 1664 | if (bt1 == VT_PTR) { |
| 1665 | 1665 | type1 = pointed_type(type1); |
| 1666 | − } else if (bt1 != VT_FUNC) | |
| 1666 | + } else if (bt1 != VT_FUNC) | |
| 1667 | 1667 | goto invalid_operands; |
| 1668 | 1668 | |
| 1669 | 1669 | if (bt2 == VT_PTR) { |
| 1670 | 1670 | type2 = pointed_type(type2); |
| 1671 | − } else if (bt2 != VT_FUNC) { | |
| 1671 | + } else if (bt2 != VT_FUNC) { | |
| 1672 | 1672 | invalid_operands: |
| 1673 | 1673 | tcc_error("invalid operands to binary %s", get_tok_str(op, NULL)); |
| 1674 | 1674 | } |
| 1675 | − if ((type1->t & VT_BTYPE) == VT_VOID || | |
| 1675 | + if ((type1->t & VT_BTYPE) == VT_VOID || | |
| 1676 | 1676 | (type2->t & VT_BTYPE) == VT_VOID) |
| 1677 | 1677 | return; |
| 1678 | 1678 | tmp_type1 = *type1; |
| @@ -1698,7 +1698,7 @@ ST_FUNC void gen_op(int op) · 19 unmodified lines | ||
| 1698 | 1698 | t2 = vtop[0].type.t; |
| 1699 | 1699 | bt1 = t1 & VT_BTYPE; |
| 1700 | 1700 | bt2 = t2 & VT_BTYPE; |
| 1701 | − | |
| 1701 | + | |
| 1702 | 1702 | if (bt1 == VT_PTR || bt2 == VT_PTR) { |
| 1703 | 1703 | /* at least one operand is a pointer */ |
| 1704 | 1704 | /* relationnal op: must be both pointers */ |
| @@ -1729,7 +1729,7 @@ ST_FUNC void gen_op(int op) · 24 unmodified lines | ||
| 1729 | 1729 | #if defined(TCC_TARGET_ARM64) || defined(TCC_TARGET_X86_64) |
| 1730 | 1730 | vtop->type.t = VT_LLONG; |
| 1731 | 1731 | #else |
| 1732 | − vtop->type.t = VT_INT; | |
| 1732 | + vtop->type.t = VT_INT; | |
| 1733 | 1733 | #endif |
| 1734 | 1734 | vswap(); |
| 1735 | 1735 | gen_op(TOK_PDIV); |
| @@ -1770,7 +1770,7 @@ ST_FUNC void gen_op(int op) · 34 unmodified lines | ||
| 1770 | 1770 | fprintf(stderr, "v+i-j = %p\n", v+i-j); |
| 1771 | 1771 | fprintf(stderr, "v+(i-j) = %p\n", v+(i-j)); |
| 1772 | 1772 | } |
| 1773 | − When this code is on. then the output looks like | |
| 1773 | + When this code is on. then the output looks like | |
| 1774 | 1774 | v+i-j = 0xfffffffe |
| 1775 | 1775 | v+(i-j) = 0xbff84000 |
| 1776 | 1776 | */ |
| @@ -1880,7 +1880,7 @@ static void gen_cvt_itof1(int t) · 103 unmodified lines | ||
| 1880 | 1880 | #ifdef TCC_TARGET_ARM64 |
| 1881 | 1881 | gen_cvt_itof(t); |
| 1882 | 1882 | #else |
| 1883 | − if ((vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) == | |
| 1883 | + if ((vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) == | |
| 1884 | 1884 | (VT_LLONG | VT_UNSIGNED)) { |
| 1885 | 1885 | |
| 1886 | 1886 | if (t == VT_FLOAT) |
| @@ -2127,7 +2127,7 @@ static void gen_cast(CType *type) · 240 unmodified lines | ||
| 2127 | 2127 | /* scalar to bool */ |
| 2128 | 2128 | vpushi(0); |
| 2129 | 2129 | gen_op(TOK_NE); |
| 2130 | − } else if ((dbt & VT_BTYPE) == VT_BYTE || | |
| 2130 | + } else if ((dbt & VT_BTYPE) == VT_BYTE || | |
| 2131 | 2131 | (dbt & VT_BTYPE) == VT_SHORT) { |
| 2132 | 2132 | if (sbt == VT_PTR) { |
| 2133 | 2133 | vtop->type.t = VT_INT; |
| @@ -2140,7 +2140,7 @@ static void gen_cast(CType *type) · 6 unmodified lines | ||
| 2140 | 2140 | /* from long long: just take low order word */ |
| 2141 | 2141 | lexpand(); |
| 2142 | 2142 | vpop(); |
| 2143 | − } | |
| 2143 | + } | |
| 2144 | 2144 | /* if lvalue and single word type, nothing to do because |
| 2145 | 2145 | the lvalue already contains the real type size (see |
| 2146 | 2146 | VT_LVAL_xxx constants) */ |
| @@ -2194,7 +2194,7 @@ ST_FUNC int type_size(CType *type, int *a) · 47 unmodified lines | ||
| 2194 | 2194 | #endif |
| 2195 | 2195 | #elif defined(TCC_TARGET_ARM) |
| 2196 | 2196 | #ifdef TCC_ARM_EABI |
| 2197 | − *a = 8; | |
| 2197 | + *a = 8; | |
| 2198 | 2198 | #else |
| 2199 | 2199 | *a = 4; |
| 2200 | 2200 | #endif |
| @@ -2289,7 +2289,7 @@ static int is_compatible_func(CType *type1, CType *type2) · 88 unmodified lines | ||
| 2289 | 2289 | /* return true if type1 and type2 are the same. If unqualified is |
| 2290 | 2290 | true, qualifiers on the types are ignored. |
| 2291 | 2291 | |
| 2292 | − - enums are not checked as gcc __builtin_types_compatible_p () | |
| 2292 | + - enums are not checked as gcc __builtin_types_compatible_p () | |
| 2293 | 2293 | */ |
| 2294 | 2294 | static int compare_types(CType *type1, CType *type2, int unqualified) |
| 2295 | 2295 | { |
| @@ -2326,7 +2326,7 @@ static int compare_types(CType *type1, CType *type2, int unqualified) · 30 unmodified lines | ||
| 2326 | 2326 | } |
| 2327 | 2327 | |
| 2328 | 2328 | /* return true if type1 and type2 are exactly the same (including |
| 2329 | − qualifiers). | |
| 2329 | + qualifiers). | |
| 2330 | 2330 | */ |
| 2331 | 2331 | static int is_compatible_types(CType *type1, CType *type2) |
| 2332 | 2332 | { |
| @@ -2344,7 +2344,7 @@ static int is_compatible_parameter_types(CType *type1, CType *type2) · 11 unmodified lines | ||
| 2344 | 2344 | printed in the type */ |
| 2345 | 2345 | /* XXX: union */ |
| 2346 | 2346 | /* XXX: add array and function pointers */ |
| 2347 | −static void type_to_str(char *buf, int buf_size, | |
| 2347 | +static void type_to_str(char *buf, int buf_size, | |
| 2348 | 2348 | CType *type, const char *varstr) |
| 2349 | 2349 | { |
| 2350 | 2350 | int bt, v, t; |
| @@ -2487,7 +2487,7 @@ static void gen_assign_cast(CType *dt) · 136 unmodified lines | ||
| 2487 | 2487 | if (sbt != VT_PTR) |
| 2488 | 2488 | goto error; |
| 2489 | 2489 | type2 = pointed_type(st); |
| 2490 | − if ((type1->t & VT_BTYPE) == VT_VOID || | |
| 2490 | + if ((type1->t & VT_BTYPE) == VT_VOID || | |
| 2491 | 2491 | (type2->t & VT_BTYPE) == VT_VOID) { |
| 2492 | 2492 | /* void * can match anything */ |
| 2493 | 2493 | } else { |
| @@ -2716,7 +2716,7 @@ ST_FUNC void inc(int post, int c) · 222 unmodified lines | ||
| 2716 | 2716 | vrotb(3); |
| 2717 | 2717 | } |
| 2718 | 2718 | /* add constant */ |
| 2719 | − vpushi(c - TOK_MID); | |
| 2719 | + vpushi(c - TOK_MID); | |
| 2720 | 2720 | gen_op('+'); |
| 2721 | 2721 | vstore(); /* store value */ |
| 2722 | 2722 | if (post) |
| @@ -2734,7 +2734,7 @@ ST_FUNC void inc(int post, int c) · 11 unmodified lines | ||
| 2734 | 2734 | static void parse_attribute(AttributeDef *ad) |
| 2735 | 2735 | { |
| 2736 | 2736 | int t, n; |
| 2737 | − | |
| 2737 | + | |
| 2738 | 2738 | while (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2) { |
| 2739 | 2739 | next(); |
| 2740 | 2740 | skip('('); |
| @@ -2787,7 +2787,7 @@ static void parse_attribute(AttributeDef *ad) · 46 unmodified lines | ||
| 2787 | 2787 | if (tok == '(') { |
| 2788 | 2788 | next(); |
| 2789 | 2789 | n = expr_const(); |
| 2790 | − if (n <= 0 || (n & (n - 1)) != 0) | |
| 2790 | + if (n <= 0 || (n & (n - 1)) != 0) | |
| 2791 | 2791 | tcc_error("alignment must be a positive power of two"); |
| 2792 | 2792 | skip(')'); |
| 2793 | 2793 | } else { |
| @@ -2828,7 +2828,7 @@ static void parse_attribute(AttributeDef *ad) · 34 unmodified lines | ||
| 2828 | 2828 | case TOK_REGPARM2: |
| 2829 | 2829 | skip('('); |
| 2830 | 2830 | n = expr_const(); |
| 2831 | − if (n > 3) | |
| 2831 | + if (n > 3) | |
| 2832 | 2832 | n = 3; |
| 2833 | 2833 | else if (n < 0) |
| 2834 | 2834 | n = 0; |
| @@ -2840,7 +2840,7 @@ static void parse_attribute(AttributeDef *ad) · 5 unmodified lines | ||
| 2840 | 2840 | case TOK_FASTCALL2: |
| 2841 | 2841 | case TOK_FASTCALL3: |
| 2842 | 2842 | ad->a.func_call = FUNC_FASTCALLW; |
| 2843 | − break; | |
| 2843 | + break; | |
| 2844 | 2844 | #endif |
| 2845 | 2845 | case TOK_MODE: |
| 2846 | 2846 | skip('('); |
| @@ -2874,9 +2874,9 @@ static void parse_attribute(AttributeDef *ad) · 27 unmodified lines | ||
| 2874 | 2874 | if (tok == '(') { |
| 2875 | 2875 | int parenthesis = 0; |
| 2876 | 2876 | do { |
| 2877 | − if (tok == '(') | |
| 2877 | + if (tok == '(') | |
| 2878 | 2878 | parenthesis++; |
| 2879 | − else if (tok == ')') | |
| 2879 | + else if (tok == ')') | |
| 2880 | 2880 | parenthesis--; |
| 2881 | 2881 | next(); |
| 2882 | 2882 | } while (parenthesis && tok != -1); |
| @@ -2928,7 +2928,7 @@ static void struct_decl(CType *type, int u, int tdef) · 45 unmodified lines | ||
| 2928 | 2928 | do_decl: |
| 2929 | 2929 | type->t = u; |
| 2930 | 2930 | type->ref = s; |
| 2931 | − | |
| 2931 | + | |
| 2932 | 2932 | if (tok == '{') { |
| 2933 | 2933 | next(); |
| 2934 | 2934 | if (s->c != -1) |
| @@ -3001,7 +3001,7 @@ static void struct_decl(CType *type, int u, int tdef) · 66 unmodified lines | ||
| 3001 | 3001 | } |
| 3002 | 3002 | if ((type1.t & VT_BTYPE) == VT_FUNC || |
| 3003 | 3003 | (type1.t & (VT_TYPEDEF | VT_STATIC | VT_EXTERN | VT_INLINE))) |
| 3004 | − tcc_error("invalid type for '%s'", | |
| 3004 | + tcc_error("invalid type for '%s'", | |
| 3005 | 3005 | get_tok_str(v, NULL)); |
| 3006 | 3006 | } |
| 3007 | 3007 | if (tok == ':') { |
| @@ -3009,10 +3009,10 @@ static void struct_decl(CType *type, int u, int tdef) · 1 unmodified line | ||
| 3009 | 3009 | bit_size = expr_const(); |
| 3010 | 3010 | /* XXX: handle v = 0 case for messages */ |
| 3011 | 3011 | if (bit_size < 0) |
| 3012 | − tcc_error("negative width in bit-field '%s'", | |
| 3012 | + tcc_error("negative width in bit-field '%s'", | |
| 3013 | 3013 | get_tok_str(v, NULL)); |
| 3014 | 3014 | if (v && bit_size == 0) |
| 3015 | − tcc_error("zero width for bit-field '%s'", | |
| 3015 | + tcc_error("zero width for bit-field '%s'", | |
| 3016 | 3016 | get_tok_str(v, NULL)); |
| 3017 | 3017 | } |
| 3018 | 3018 | size = type_size(&type1, &align); |
| @@ -3028,8 +3028,8 @@ static void struct_decl(CType *type, int u, int tdef) · 9 unmodified lines | ||
| 3028 | 3028 | lbit_pos = 0; |
| 3029 | 3029 | if (bit_size >= 0) { |
| 3030 | 3030 | bt = type1.t & VT_BTYPE; |
| 3031 | − if (bt != VT_INT && | |
| 3032 | − bt != VT_BYTE && | |
| 3031 | + if (bt != VT_INT && | |
| 3032 | + bt != VT_BYTE && | |
| 3033 | 3033 | bt != VT_SHORT && |
| 3034 | 3034 | bt != VT_BOOL && |
| 3035 | 3035 | bt != VT_ENUM && |
| @@ -3056,7 +3056,7 @@ static void struct_decl(CType *type, int u, int tdef) · 20 unmodified lines | ||
| 3056 | 3056 | bit_pos = 0; |
| 3057 | 3057 | lbit_pos = bit_pos; |
| 3058 | 3058 | /* XXX: handle LSB first */ |
| 3059 | − type1.t |= VT_BITFIELD | | |
| 3059 | + type1.t |= VT_BITFIELD | | |
| 3060 | 3060 | (bit_pos << VT_STRUCT_SHIFT) | |
| 3061 | 3061 | (bit_size << (VT_STRUCT_SHIFT + 6)); |
| 3062 | 3062 | bit_pos += bit_size; |
| @@ -3083,10 +3083,10 @@ static void struct_decl(CType *type, int u, int tdef) · 20 unmodified lines | ||
| 3083 | 3083 | maxalign = align; |
| 3084 | 3084 | } |
| 3085 | 3085 | #if 0 |
| 3086 | − printf("add field %s offset=%d", | |
| 3086 | + printf("add field %s offset=%d", | |
| 3087 | 3087 | get_tok_str(v, NULL), offset); |
| 3088 | 3088 | if (type1.t & VT_BITFIELD) { |
| 3089 | − printf(" pos=%d size=%d", | |
| 3089 | + printf(" pos=%d size=%d", | |
| 3090 | 3090 | (type1.t >> VT_STRUCT_SHIFT) & 0x3f, |
| 3091 | 3091 | (type1.t >> (VT_STRUCT_SHIFT + 6)) & 0x3f); |
| 3092 | 3092 | } |
| @@ -3113,7 +3113,7 @@ static void struct_decl(CType *type, int u, int tdef) · 20 unmodified lines | ||
| 3113 | 3113 | } |
| 3114 | 3114 | skip('}'); |
| 3115 | 3115 | /* store size and alignment */ |
| 3116 | − s->c = (c + maxalign - 1) & -maxalign; | |
| 3116 | + s->c = (c + maxalign - 1) & -maxalign; | |
| 3117 | 3117 | s->r = maxalign; |
| 3118 | 3118 | } |
| 3119 | 3119 | } |
| @@ -3126,7 +3126,7 @@ ST_FUNC int is_btype_size(int bt) · 6 unmodified lines | ||
| 3126 | 3126 | } |
| 3127 | 3127 | |
| 3128 | 3128 | /* return 0 if no type declaration. otherwise, return the basic type |
| 3129 | − and skip it. | |
| 3129 | + and skip it. | |
| 3130 | 3130 | */ |
| 3131 | 3131 | static int parse_btype(CType *type, AttributeDef *ad) |
| 3132 | 3132 | { |
| @@ -3436,9 +3436,9 @@ static void post_type(CType *type, AttributeDef *ad) · 303 unmodified lines | ||
| 3436 | 3436 | skip(')'); |
| 3437 | 3437 | /* NOTE: const is ignored in returned type as it has a special |
| 3438 | 3438 | meaning in gcc / C++ */ |
| 3439 | − type->t &= ~VT_CONSTANT; | |
| 3439 | + type->t &= ~VT_CONSTANT; | |
| 3440 | 3440 | /* some ancient pre-K&R C allows a function to return an array |
| 3441 | − and the array brackets to be put after the arguments, such | |
| 3441 | + and the array brackets to be put after the arguments, such | |
| 3442 | 3442 | that "int c()[]" means something like "int[] c()" */ |
| 3443 | 3443 | if (tok == '[') { |
| 3444 | 3444 | next(); |
| @@ -3479,7 +3479,7 @@ static void post_type(CType *type, AttributeDef *ad) · 34 unmodified lines | ||
| 3479 | 3479 | if (type->t == VT_FUNC) |
| 3480 | 3480 | tcc_error("declaration of an array of functions"); |
| 3481 | 3481 | t1 |= type->t & VT_VLA; |
| 3482 | − | |
| 3482 | + | |
| 3483 | 3483 | if (t1 & VT_VLA) { |
| 3484 | 3484 | loc -= type_size(&int_type, &align); |
| 3485 | 3485 | loc &= -align; |
| @@ -3493,7 +3493,7 @@ static void post_type(CType *type, AttributeDef *ad) · 7 unmodified lines | ||
| 3493 | 3493 | } |
| 3494 | 3494 | if (n != -1) |
| 3495 | 3495 | vpop(); |
| 3496 | − | |
| 3496 | + | |
| 3497 | 3497 | /* we push an anonymous symbol which will contain the array |
| 3498 | 3498 | element type */ |
| 3499 | 3499 | s = sym_push(SYM_FIELD, type, 0, n); |
| @@ -3506,7 +3506,7 @@ static void post_type(CType *type, AttributeDef *ad) · 6 unmodified lines | ||
| 3506 | 3506 | in 'type'. 'td' is a bitmask indicating which kind of type decl is |
| 3507 | 3507 | expected. 'type' should contain the basic type. 'ad' is the |
| 3508 | 3508 | attribute definition of the basic type. It can be modified by |
| 3509 | − type_decl(). | |
| 3509 | + type_decl(). | |
| 3510 | 3510 | */ |
| 3511 | 3511 | static void type_decl(CType *type, AttributeDef *ad, int *v, int td) |
| 3512 | 3512 | { |
| @@ -3537,7 +3537,7 @@ static void type_decl(CType *type, AttributeDef *ad, int *v, int td) · 24 unmodified lines | ||
| 3537 | 3537 | mk_pointer(type); |
| 3538 | 3538 | type->t |= qualifiers; |
| 3539 | 3539 | } |
| 3540 | − | |
| 3540 | + | |
| 3541 | 3541 | /* XXX: clarify attribute handling */ |
| 3542 | 3542 | if (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2) |
| 3543 | 3543 | parse_attribute(ad); |
| @@ -3576,7 +3576,7 @@ static void type_decl(CType *type, AttributeDef *ad, int *v, int td) · 32 unmodified lines | ||
| 3576 | 3576 | type->t |= storage; |
| 3577 | 3577 | if (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2) |
| 3578 | 3578 | parse_attribute(ad); |
| 3579 | − | |
| 3579 | + | |
| 3580 | 3580 | if (!type1.t) |
| 3581 | 3581 | return; |
| 3582 | 3582 | /* append type at the end of type1 */ |
| @@ -3711,7 +3711,7 @@ ST_FUNC void unary(void) · 128 unmodified lines | ||
| 3711 | 3711 | next(); |
| 3712 | 3712 | goto tok_next; |
| 3713 | 3713 | case TOK_CINT: |
| 3714 | − case TOK_CCHAR: | |
| 3714 | + case TOK_CCHAR: | |
| 3715 | 3715 | case TOK_LCHAR: |
| 3716 | 3716 | vpushi(tokc.i); |
| 3717 | 3717 | next(); |
| @@ -3814,7 +3814,7 @@ ST_FUNC void unary(void) · 96 unmodified lines | ||
| 3814 | 3814 | linux/include/net/tcp.h:945: error: statement expression in global scope */ |
| 3815 | 3815 | |
| 3816 | 3816 | /* save all registers */ |
| 3817 | − save_regs(0); | |
| 3817 | + save_regs(0); | |
| 3818 | 3818 | /* statement expression : we do not accept break/continue |
| 3819 | 3819 | inside as GCC does */ |
| 3820 | 3820 | block(NULL, NULL, NULL, NULL, 0, 1); |
| @@ -4087,7 +4087,7 @@ ST_FUNC void unary(void) · 266 unmodified lines | ||
| 4087 | 4087 | vpushsym(&s->type, s); |
| 4088 | 4088 | next(); |
| 4089 | 4089 | break; |
| 4090 | − | |
| 4090 | + | |
| 4091 | 4091 | // special qnan , snan and infinity values |
| 4092 | 4092 | case TOK___NAN__: |
| 4093 | 4093 | vpush64(VT_DOUBLE, 0x7ff8000000000000ULL); |
| @@ -4123,7 +4123,7 @@ ST_FUNC void unary(void) · 29 unmodified lines | ||
| 4123 | 4123 | #endif |
| 4124 | 4124 | ) |
| 4125 | 4125 | tcc_warning("implicit declaration of function '%s'", name); |
| 4126 | − s = external_global_sym(t, &func_old_type, 0); | |
| 4126 | + s = external_global_sym(t, &func_old_type, 0); | |
| 4127 | 4127 | } |
| 4128 | 4128 | if ((s->type.t & (VT_STATIC | VT_INLINE | VT_BTYPE)) == |
| 4129 | 4129 | (VT_STATIC | VT_INLINE | VT_FUNC)) { |
| @@ -4146,7 +4146,7 @@ ST_FUNC void unary(void) · 16 unmodified lines | ||
| 4146 | 4146 | } |
| 4147 | 4147 | break; |
| 4148 | 4148 | } |
| 4149 | − | |
| 4149 | + | |
| 4150 | 4150 | /* post operations */ |
| 4151 | 4151 | while (1) { |
| 4152 | 4152 | if (tok == TOK_INC || tok == TOK_DEC) { |
| @@ -4154,8 +4154,8 @@ ST_FUNC void unary(void) · 1 unmodified line | ||
| 4154 | 4154 | next(); |
| 4155 | 4155 | } else if (tok == '.' || tok == TOK_ARROW) { |
| 4156 | 4156 | int qualifiers; |
| 4157 | − /* field */ | |
| 4158 | − if (tok == TOK_ARROW) | |
| 4157 | + /* field */ | |
| 4158 | + if (tok == TOK_ARROW) | |
| 4159 | 4159 | indir(); |
| 4160 | 4160 | qualifiers = vtop->type.t & (VT_CONSTANT | VT_VOLATILE); |
| 4161 | 4161 | test_lvalue(); |
| @@ -4637,7 +4637,7 @@ static void expr_cond(void) · 475 unmodified lines | ||
| 4637 | 4637 | (t2 & (VT_BTYPE | VT_UNSIGNED)) == (VT_INT | VT_UNSIGNED)) |
| 4638 | 4638 | type.t |= VT_UNSIGNED; |
| 4639 | 4639 | } |
| 4640 | − | |
| 4640 | + | |
| 4641 | 4641 | /* now we convert second operand */ |
| 4642 | 4642 | gen_cast(&type); |
| 4643 | 4643 | if (VT_STRUCT == (vtop->type.t & VT_BTYPE)) |
| @@ -4653,9 +4653,9 @@ static void expr_cond(void) · 9 unmodified lines | ||
| 4653 | 4653 | } else if ((type.t & VT_BTYPE) == VT_LLONG) { |
| 4654 | 4654 | /* for long longs, we use fixed registers to avoid having |
| 4655 | 4655 | to handle a complicated move */ |
| 4656 | − rc = RC_IRET; | |
| 4656 | + rc = RC_IRET; | |
| 4657 | 4657 | } |
| 4658 | − | |
| 4658 | + | |
| 4659 | 4659 | r2 = gv(rc); |
| 4660 | 4660 | /* this is horrible, but we must also convert first |
| 4661 | 4661 | operand */ |
| @@ -4677,7 +4677,7 @@ static void expr_cond(void) · 15 unmodified lines | ||
| 4677 | 4677 | static void expr_eq(void) |
| 4678 | 4678 | { |
| 4679 | 4679 | int t; |
| 4680 | − | |
| 4680 | + | |
| 4681 | 4681 | expr_cond(); |
| 4682 | 4682 | if (tok == '=' || |
| 4683 | 4683 | (tok >= TOK_A_MOD && tok <= TOK_A_DIV) || |
| @@ -4797,7 +4797,7 @@ static void label_or_decl(int l) · 113 unmodified lines | ||
| 4797 | 4797 | decl(l); |
| 4798 | 4798 | } |
| 4799 | 4799 | |
| 4800 | −static void block(int *bsym, int *csym, int *case_sym, int *def_sym, | |
| 4800 | +static void block(int *bsym, int *csym, int *case_sym, int *def_sym, | |
| 4801 | 4801 | int case_reg, int is_expr) |
| 4802 | 4802 | { |
| 4803 | 4803 | int a, b, c, d; |
| @@ -4858,7 +4858,7 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 54 unmodified lines | ||
| 4858 | 4858 | frame_bottom->next = scope_stack_bottom; |
| 4859 | 4859 | scope_stack_bottom = frame_bottom; |
| 4860 | 4860 | llabel = local_label_stack; |
| 4861 | − | |
| 4861 | + | |
| 4862 | 4862 | /* handle local labels declarations */ |
| 4863 | 4863 | if (tok == TOK_LABEL) { |
| 4864 | 4864 | next(); |
| @@ -4906,14 +4906,14 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 41 unmodified lines | ||
| 4906 | 4906 | /* pop locally defined symbols */ |
| 4907 | 4907 | scope_stack_bottom = scope_stack_bottom->next; |
| 4908 | 4908 | sym_pop(&local_stack, s); |
| 4909 | − | |
| 4909 | + | |
| 4910 | 4910 | /* Pop VLA frames and restore stack pointer if required */ |
| 4911 | 4911 | if (vlas_in_scope > saved_vlas_in_scope) { |
| 4912 | 4912 | vla_sp_loc = saved_vlas_in_scope ? block_vla_sp_loc : vla_sp_root_loc; |
| 4913 | 4913 | vla_sp_restore(); |
| 4914 | 4914 | } |
| 4915 | 4915 | vlas_in_scope = saved_vlas_in_scope; |
| 4916 | − | |
| 4916 | + | |
| 4917 | 4917 | next(); |
| 4918 | 4918 | } else if (tok == TOK_RETURN) { |
| 4919 | 4919 | next(); |
| @@ -5080,7 +5080,7 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 160 unmodified lines | ||
| 5080 | 5080 | gsym_addr(b, c); |
| 5081 | 5081 | scope_stack_bottom = scope_stack_bottom->next; |
| 5082 | 5082 | sym_pop(&local_stack, s); |
| 5083 | − } else | |
| 5083 | + } else | |
| 5084 | 5084 | if (tok == TOK_DO) { |
| 5085 | 5085 | next(); |
| 5086 | 5086 | a = 0; |
| @@ -5154,7 +5154,7 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 67 unmodified lines | ||
| 5154 | 5154 | skip(':'); |
| 5155 | 5155 | is_expr = 0; |
| 5156 | 5156 | goto block_after_label; |
| 5157 | − } else | |
| 5157 | + } else | |
| 5158 | 5158 | if (tok == TOK_DEFAULT) { |
| 5159 | 5159 | next(); |
| 5160 | 5160 | skip(':'); |
| @@ -5185,7 +5185,7 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 24 unmodified lines | ||
| 5185 | 5185 | s->r = LABEL_FORWARD; |
| 5186 | 5186 | } |
| 5187 | 5187 | vla_sp_restore_root(); |
| 5188 | − if (s->r & LABEL_FORWARD) | |
| 5188 | + if (s->r & LABEL_FORWARD) | |
| 5189 | 5189 | s->jnext = gjmp(s->jnext); |
| 5190 | 5190 | else |
| 5191 | 5191 | gjmp_addr(s->jnext); |
| @@ -5240,8 +5240,8 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 48 unmodified lines | ||
| 5240 | 5240 | address. cur_index/cur_field is the pointer to the current |
| 5241 | 5241 | value. 'size_only' is true if only size info is needed (only used |
| 5242 | 5242 | in arrays) */ |
| 5243 | −static void decl_designator(CType *type, Section *sec, unsigned long c, | |
| 5244 | − int *cur_index, Sym **cur_field, | |
| 5243 | +static void decl_designator(CType *type, Section *sec, unsigned long c, | |
| 5244 | + int *cur_index, Sym **cur_field, | |
| 5245 | 5245 | int size_only) |
| 5246 | 5246 | { |
| 5247 | 5247 | Sym *s, *f; |
| @@ -5265,7 +5265,7 @@ static void decl_designator(CType *type, Section *sec, unsigned long c, · 17 unmodified lines | ||
| 5265 | 5265 | if (tok == TOK_DOTS && gnu_ext) { |
| 5266 | 5266 | next(); |
| 5267 | 5267 | index_last = expr_const(); |
| 5268 | − if (index_last < 0 || | |
| 5268 | + if (index_last < 0 || | |
| 5269 | 5269 | (s->c >= 0 && index_last >= s->c) || |
| 5270 | 5270 | index_last < index) |
| 5271 | 5271 | expect("invalid index"); |
| @@ -5361,7 +5361,7 @@ static void decl_designator(CType *type, Section *sec, unsigned long c, · 89 unmodified lines | ||
| 5361 | 5361 | #define EXPR_ANY 2 |
| 5362 | 5362 | |
| 5363 | 5363 | /* store a value or an expression directly in global data or in local array */ |
| 5364 | −static void init_putv(CType *type, Section *sec, unsigned long c, | |
| 5364 | +static void init_putv(CType *type, Section *sec, unsigned long c, | |
| 5365 | 5365 | int v, int expr_type) |
| 5366 | 5366 | { |
| 5367 | 5367 | int saved_global_expr, bt, bit_pos, bit_size; |
| @@ -5387,7 +5387,7 @@ static void init_putv(CType *type, Section *sec, unsigned long c, · 19 unmodified lines | ||
| 5387 | 5387 | expr_eq(); |
| 5388 | 5388 | break; |
| 5389 | 5389 | } |
| 5390 | − | |
| 5390 | + | |
| 5391 | 5391 | dtype = *type; |
| 5392 | 5392 | dtype.t &= ~VT_CONSTANT; /* need to do that to avoid false warning */ |
| 5393 | 5393 | |
| @@ -5502,7 +5502,7 @@ static void init_putz(CType *t, Section *sec, unsigned long c, int size) · 108 unmodified lines | ||
| 5502 | 5502 | allocation. 'first' is true if array '{' must be read (multi |
| 5503 | 5503 | dimension implicit array init handling). 'size_only' is true if |
| 5504 | 5504 | size only evaluation is wanted (only for arrays). */ |
| 5505 | −static void decl_initializer(CType *type, Section *sec, unsigned long c, | |
| 5505 | +static void decl_initializer(CType *type, Section *sec, unsigned long c, | |
| 5506 | 5506 | int first, int size_only) |
| 5507 | 5507 | { |
| 5508 | 5508 | int index, array_length, n, no_oblock, nb, parlevel, parlevel1, i; |
| @@ -5512,14 +5512,14 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 3 unmodified lines | ||
| 5512 | 5512 | |
| 5513 | 5513 | if (type->t & VT_VLA) { |
| 5514 | 5514 | int a; |
| 5515 | − | |
| 5515 | + | |
| 5516 | 5516 | /* save current stack pointer */ |
| 5517 | 5517 | if (vlas_in_scope == 0) { |
| 5518 | 5518 | if (vla_sp_root_loc == -1) |
| 5519 | 5519 | vla_sp_root_loc = (loc -= PTR_SIZE); |
| 5520 | 5520 | gen_vla_sp_save(vla_sp_root_loc); |
| 5521 | 5521 | } |
| 5522 | − | |
| 5522 | + | |
| 5523 | 5523 | vla_runtime_type_size(type, &a); |
| 5524 | 5524 | gen_vla_alloc(type, a); |
| 5525 | 5525 | gen_vla_sp_save(c); |
| @@ -5533,7 +5533,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 7 unmodified lines | ||
| 5533 | 5533 | size1 = type_size(t1, &align1); |
| 5534 | 5534 | |
| 5535 | 5535 | no_oblock = 1; |
| 5536 | − if ((first && tok != TOK_LSTR && tok != TOK_STR) || | |
| 5536 | + if ((first && tok != TOK_LSTR && tok != TOK_STR) || | |
| 5537 | 5537 | tok == '{') { |
| 5538 | 5538 | if (tok != '{') |
| 5539 | 5539 | tcc_error("character array initializer must be a literal," |
| @@ -5544,7 +5544,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 4 unmodified lines | ||
| 5544 | 5544 | |
| 5545 | 5545 | /* only parse strings here if correct type (otherwise: handle |
| 5546 | 5546 | them as ((w)char *) expressions */ |
| 5547 | − if ((tok == TOK_LSTR && | |
| 5547 | + if ((tok == TOK_LSTR && | |
| 5548 | 5548 | #ifdef TCC_TARGET_PE |
| 5549 | 5549 | (t1->t & VT_BTYPE) == VT_SHORT && (t1->t & VT_UNSIGNED) |
| 5550 | 5550 | #else |
| @@ -5604,7 +5604,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 53 unmodified lines | ||
| 5604 | 5604 | /* must put zero in holes (note that doing it that way |
| 5605 | 5605 | ensures that it even works with designators) */ |
| 5606 | 5606 | if (!size_only && array_length < index) { |
| 5607 | − init_putz(t1, sec, c + array_length * size1, | |
| 5607 | + init_putz(t1, sec, c + array_length * size1, | |
| 5608 | 5608 | (index - array_length) * size1); |
| 5609 | 5609 | } |
| 5610 | 5610 | index++; |
| @@ -5624,7 +5624,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 13 unmodified lines | ||
| 5624 | 5624 | skip('}'); |
| 5625 | 5625 | /* put zeros at the end */ |
| 5626 | 5626 | if (!size_only && n >= 0 && array_length < n) { |
| 5627 | − init_putz(t1, sec, c + array_length * size1, | |
| 5627 | + init_putz(t1, sec, c + array_length * size1, | |
| 5628 | 5628 | (n - array_length) * size1); |
| 5629 | 5629 | } |
| 5630 | 5630 | /* patch type size if needed */ |
| @@ -5690,7 +5690,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 59 unmodified lines | ||
| 5690 | 5690 | decl_designator(type, sec, c, NULL, &f, size_only); |
| 5691 | 5691 | index = f->c; |
| 5692 | 5692 | if (!size_only && array_length < index) { |
| 5693 | − init_putz(type, sec, c + array_length, | |
| 5693 | + init_putz(type, sec, c + array_length, | |
| 5694 | 5694 | index - array_length); |
| 5695 | 5695 | } |
| 5696 | 5696 | index = index + type_size(&f->type, &align1); |
| @@ -5743,7 +5743,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 46 unmodified lines | ||
| 5743 | 5743 | } |
| 5744 | 5744 | /* put zeros at the end */ |
| 5745 | 5745 | if (!size_only && array_length < n) { |
| 5746 | − init_putz(type, sec, c + array_length, | |
| 5746 | + init_putz(type, sec, c + array_length, | |
| 5747 | 5747 | n - array_length); |
| 5748 | 5748 | } |
| 5749 | 5749 | if (!no_oblock) |
| @@ -5795,7 +5795,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 45 unmodified lines | ||
| 5795 | 5795 | zero, then a reference to the new object is put in the value stack. |
| 5796 | 5796 | If 'has_init' is 2, a special parsing is done to handle string |
| 5797 | 5797 | constants. */ |
| 5798 | −static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, | |
| 5798 | +static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, | |
| 5799 | 5799 | int has_init, int v, char *asm_label, |
| 5800 | 5800 | int scope) |
| 5801 | 5801 | { |
| @@ -5826,7 +5826,7 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, · 24 unmodified lines | ||
| 5826 | 5826 | initializers handling */ |
| 5827 | 5827 | tok_str_new(&init_str); |
| 5828 | 5828 | if (size < 0 || (flexible_array && has_init)) { |
| 5829 | − if (!has_init) | |
| 5829 | + if (!has_init) | |
| 5830 | 5830 | tcc_error("unknown type size"); |
| 5831 | 5831 | /* get all init string */ |
| 5832 | 5832 | if (has_init == 2) { |
| @@ -5855,7 +5855,7 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, · 22 unmodified lines | ||
| 5855 | 5855 | } |
| 5856 | 5856 | tok_str_add(&init_str, -1); |
| 5857 | 5857 | tok_str_add(&init_str, 0); |
| 5858 | − | |
| 5858 | + | |
| 5859 | 5859 | /* compute size */ |
| 5860 | 5860 | save_parse_state(&saved_parse_state); |
| 5861 | 5861 | |
| @@ -5865,10 +5865,10 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, · 3 unmodified lines | ||
| 5865 | 5865 | /* prepare second initializer parsing */ |
| 5866 | 5866 | macro_ptr = init_str.str; |
| 5867 | 5867 | next(); |
| 5868 | − | |
| 5868 | + | |
| 5869 | 5869 | /* if still unknown size, error */ |
| 5870 | 5870 | size = type_size(type, &align); |
| 5871 | − if (size < 0) | |
| 5871 | + if (size < 0) | |
| 5872 | 5872 | tcc_error("unknown type size"); |
| 5873 | 5873 | } |
| 5874 | 5874 | if (flexible_array) |
| @@ -5919,14 +5919,14 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, · 44 unmodified lines | ||
| 5919 | 5919 | sym = sym_find(v); |
| 5920 | 5920 | if (sym) { |
| 5921 | 5921 | if (!is_compatible_types(&sym->type, type)) |
| 5922 | − tcc_error("incompatible types for redefinition of '%s'", | |
| 5922 | + tcc_error("incompatible types for redefinition of '%s'", | |
| 5923 | 5923 | get_tok_str(v, NULL)); |
| 5924 | 5924 | if (sym->type.t & VT_EXTERN) { |
| 5925 | 5925 | /* if the variable is extern, it was not allocated */ |
| 5926 | 5926 | sym->type.t &= ~VT_EXTERN; |
| 5927 | 5927 | /* set array size if it was omitted in extern |
| 5928 | 5928 | declaration */ |
| 5929 | − if ((sym->type.t & VT_ARRAY) && | |
| 5929 | + if ((sym->type.t & VT_ARRAY) && | |
| 5930 | 5930 | sym->type.ref->c < 0 && |
| 5931 | 5931 | type->ref->c >= 0) |
| 5932 | 5932 | sym->type.ref->c = type->ref->c; |
| @@ -5966,7 +5966,7 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, · 33 unmodified lines | ||
| 5966 | 5966 | #endif |
| 5967 | 5967 | sec->data_offset = data_offset; |
| 5968 | 5968 | /* allocate section space to put the data */ |
| 5969 | − if (sec->sh_type != SHT_NOBITS && | |
| 5969 | + if (sec->sh_type != SHT_NOBITS && | |
| 5970 | 5970 | data_offset > sec->data_allocated) |
| 5971 | 5971 | section_realloc(sec, data_offset); |
| 5972 | 5972 | /* align section if needed */ |
| @@ -6036,12 +6036,12 @@ static void put_func_debug(Sym *sym) · 63 unmodified lines | ||
| 6036 | 6036 | |
| 6037 | 6037 | /* stabs info */ |
| 6038 | 6038 | /* XXX: we put here a dummy type */ |
| 6039 | − snprintf(buf, sizeof(buf), "%s:%c1", | |
| 6039 | + snprintf(buf, sizeof(buf), "%s:%c1", | |
| 6040 | 6040 | funcname, sym->type.t & VT_STATIC ? 'f' : 'F'); |
| 6041 | 6041 | put_stabs_r(buf, N_FUN, 0, file->line_num, 0, |
| 6042 | 6042 | cur_text_section, sym->c); |
| 6043 | 6043 | /* //gr gdb wants a line at the function */ |
| 6044 | − put_stabn(N_SLINE, 0, file->line_num, 0); | |
| 6044 | + put_stabn(N_SLINE, 0, file->line_num, 0); | |
| 6045 | 6045 | last_ind = 0; |
| 6046 | 6046 | last_line_num = 0; |
| 6047 | 6047 | } |
| @@ -6058,10 +6058,10 @@ static void func_decl_list(Sym *func_sym) · 10 unmodified lines | ||
| 6058 | 6058 | /* parse each declaration */ |
| 6059 | 6059 | while (tok != '{' && tok != ';' && tok != ',' && tok != TOK_EOF && |
| 6060 | 6060 | tok != TOK_ASM1 && tok != TOK_ASM2 && tok != TOK_ASM3) { |
| 6061 | − if (!parse_btype(&btype, &ad)) | |
| 6061 | + if (!parse_btype(&btype, &ad)) | |
| 6062 | 6062 | expect("declaration list"); |
| 6063 | 6063 | if (((btype.t & VT_BTYPE) == VT_ENUM || |
| 6064 | − (btype.t & VT_BTYPE) == VT_STRUCT) && | |
| 6064 | + (btype.t & VT_BTYPE) == VT_STRUCT) && | |
| 6065 | 6065 | tok == ';') { |
| 6066 | 6066 | /* we accept no variable after */ |
| 6067 | 6067 | } else { |
| @@ -6080,7 +6080,7 @@ static void func_decl_list(Sym *func_sym) · 12 unmodified lines | ||
| 6080 | 6080 | found: |
| 6081 | 6081 | /* check that no storage specifier except 'register' was given */ |
| 6082 | 6082 | if (type.t & VT_STORAGE) |
| 6083 | − tcc_error("storage class specified for '%s'", get_tok_str(v, NULL)); | |
| 6083 | + tcc_error("storage class specified for '%s'", get_tok_str(v, NULL)); | |
| 6084 | 6084 | convert_parameter_type(&type); |
| 6085 | 6085 | /* we can add the type (NOTE: it could be local to the function) */ |
| 6086 | 6086 | s->type = type; |
| @@ -6140,7 +6140,7 @@ static void gen_function(Sym *sym) · 53 unmodified lines | ||
| 6140 | 6140 | sym_pop(&local_stack, NULL); |
| 6141 | 6141 | /* end of function */ |
| 6142 | 6142 | /* patch symbol size */ |
| 6143 | − ((ElfW(Sym) *)symtab_section->data)[sym->c].st_size = | |
| 6143 | + ((ElfW(Sym) *)symtab_section->data)[sym->c].st_size = | |
| 6144 | 6144 | ind - func_ind; |
| 6145 | 6145 | /* patch symbol weakness (this definition overrules any prototype) */ |
| 6146 | 6146 | if (sym->type.t & VT_WEAK) |
| @@ -6234,7 +6234,7 @@ static int decl0(int l, int is_for_loop_init) · 87 unmodified lines | ||
| 6234 | 6234 | btype.t = VT_INT; |
| 6235 | 6235 | } |
| 6236 | 6236 | if (((btype.t & VT_BTYPE) == VT_ENUM || |
| 6237 | − (btype.t & VT_BTYPE) == VT_STRUCT) && | |
| 6237 | + (btype.t & VT_BTYPE) == VT_STRUCT) && | |
| 6238 | 6238 | tok == ';') { |
| 6239 | 6239 | if ((btype.t & VT_BTYPE) == VT_STRUCT) { |
| 6240 | 6240 | int v = btype.ref->v; |
| @@ -6273,7 +6273,7 @@ static int decl0(int l, int is_for_loop_init) · 32 unmodified lines | ||
| 6273 | 6273 | asm_label_instr(&astr); |
| 6274 | 6274 | asm_label = tcc_strdup(astr.data); |
| 6275 | 6275 | cstr_free(&astr); |
| 6276 | − | |
| 6276 | + | |
| 6277 | 6277 | /* parse one last attribute list, after asm label */ |
| 6278 | 6278 | parse_attribute(&ad); |
| 6279 | 6279 | } |
| @@ -6299,11 +6299,11 @@ static int decl0(int l, int is_for_loop_init) · 19 unmodified lines | ||
| 6299 | 6299 | while ((sym = sym->next) != NULL) |
| 6300 | 6300 | if (!(sym->v & ~SYM_FIELD)) |
| 6301 | 6301 | expect("identifier"); |
| 6302 | − | |
| 6302 | + | |
| 6303 | 6303 | /* XXX: cannot do better now: convert extern line to static inline */ |
| 6304 | 6304 | if ((type.t & (VT_EXTERN | VT_INLINE)) == (VT_EXTERN | VT_INLINE)) |
| 6305 | 6305 | type.t = (type.t & ~VT_EXTERN) | VT_STATIC; |
| 6306 | − | |
| 6306 | + | |
| 6307 | 6307 | sym = sym_find(v); |
| 6308 | 6308 | if (sym) { |
| 6309 | 6309 | Sym *ref; |
| @@ -6334,7 +6334,7 @@ static int decl0(int l, int is_for_loop_init) · 24 unmodified lines | ||
| 6334 | 6334 | |
| 6335 | 6335 | if (!is_compatible_types(&sym->type, &type)) { |
| 6336 | 6336 | func_error1: |
| 6337 | − tcc_error("incompatible types for redefinition of '%s'", | |
| 6337 | + tcc_error("incompatible types for redefinition of '%s'", | |
| 6338 | 6338 | get_tok_str(v, NULL)); |
| 6339 | 6339 | } |
| 6340 | 6340 | type.ref->a.func_proto = 0; |
| @@ -6349,18 +6349,18 @@ static int decl0(int l, int is_for_loop_init) · 8 unmodified lines | ||
| 6349 | 6349 | /* static inline functions are just recorded as a kind |
| 6350 | 6350 | of macro. Their code will be emitted at the end of |
| 6351 | 6351 | the compilation unit only if they are used */ |
| 6352 | − if ((type.t & (VT_INLINE | VT_STATIC)) == | |
| 6352 | + if ((type.t & (VT_INLINE | VT_STATIC)) == | |
| 6353 | 6353 | (VT_INLINE | VT_STATIC)) { |
| 6354 | 6354 | int block_level; |
| 6355 | 6355 | struct InlineFunc *fn; |
| 6356 | 6356 | const char *filename; |
| 6357 | − | |
| 6357 | + | |
| 6358 | 6358 | filename = file ? file->filename : ""; |
| 6359 | 6359 | fn = tcc_malloc(sizeof *fn + strlen(filename)); |
| 6360 | 6360 | strcpy(fn->filename, filename); |
| 6361 | 6361 | fn->sym = sym; |
| 6362 | 6362 | tok_str_new(&fn->func_str); |
| 6363 | − | |
| 6363 | + | |
| 6364 | 6364 | block_level = 0; |
| 6365 | 6365 | for(;;) { |
| 6366 | 6366 | int t; |
| @@ -1,8 +1,8 @@ | ||
| 1 | −/* Simple libc header for TCC | |
| 2 | − * | |
| 1 | +/* Simple libc header for TCC | |
| 2 | + * | |
| 3 | 3 | * Add any function you want from the libc there. This file is here |
| 4 | 4 | * only for your convenience so that you do not need to put the whole |
| 5 | − * glibc include files on your floppy disk | |
| 5 | + * glibc include files on your floppy disk | |
| 6 | 6 | */ |
| 7 | 7 | #ifndef _TCCLIB_H |
| 8 | 8 | #define _TCCLIB_H |
| @@ -1266,7 +1266,7 @@ static int pe_check_symbols(struct pe_info *pe) · 1265 unmodified lines | ||
| 1266 | 1266 | put_elf_reloc(symtab_section, text_section, |
| 1267 | 1267 | offset + 8, R_XXX_THUNKFIX, is->iat_index); // offset to IAT position |
| 1268 | 1268 | #else |
| 1269 | − put_elf_reloc(symtab_section, text_section, | |
| 1269 | + put_elf_reloc(symtab_section, text_section, | |
| 1270 | 1270 | offset + 2, R_XXX_THUNKFIX, is->iat_index); |
| 1271 | 1271 | #endif |
| 1272 | 1272 | is->thk_offset = offset; |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * TCC - Tiny C Compiler |
| 3 | − * | |
| 3 | + * | |
| 4 | 4 | * Copyright (c) 2001-2004 Fabrice Bellard |
| 5 | 5 | * |
| 6 | 6 | * This library is free software; you can redistribute it and/or |
| @@ -50,7 +50,7 @@ static unsigned char isidnum_table[256 - CH_EOF]; · 43 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | static TokenString *macro_stack; |
| 52 | 52 | |
| 53 | −static const char tcc_keywords[] = | |
| 53 | +static const char tcc_keywords[] = | |
| 54 | 54 | #define DEF(id, str) str "\0" |
| 55 | 55 | #include "tcctok.h" |
| 56 | 56 | #undef DEF |
| @@ -221,7 +221,7 @@ static TokenSym *tok_alloc_new(TokenSym **pts, const char *str, int len) · 164 unmodified lines | ||
| 221 | 221 | TokenSym *ts, **ptable; |
| 222 | 222 | int i; |
| 223 | 223 | |
| 224 | − if (tok_ident >= SYM_FIRST_ANOM) | |
| 224 | + if (tok_ident >= SYM_FIRST_ANOM) | |
| 225 | 225 | tcc_error("memory full (symbols)"); |
| 226 | 226 | |
| 227 | 227 | /* expand token table if needed */ |
| @@ -255,7 +255,7 @@ ST_FUNC TokenSym *tok_alloc(const char *str, int len) · 27 unmodified lines | ||
| 255 | 255 | TokenSym *ts, **pts; |
| 256 | 256 | int i; |
| 257 | 257 | unsigned int h; |
| 258 | − | |
| 258 | + | |
| 259 | 259 | h = TOK_HASH_INIT; |
| 260 | 260 | for(i=0;i<len;i++) |
| 261 | 261 | h = TOK_HASH_FUNC(h, ((unsigned char *)str)[i]); |
| @@ -511,7 +511,7 @@ static int handle_stray1(uint8_t *p) · 249 unmodified lines | ||
| 511 | 511 | ST_FUNC void minp(void) |
| 512 | 512 | { |
| 513 | 513 | inp(); |
| 514 | − if (ch == '\\') | |
| 514 | + if (ch == '\\') | |
| 515 | 515 | handle_stray(); |
| 516 | 516 | } |
| 517 | 517 | |
| @@ -557,7 +557,7 @@ static uint8_t *parse_line_comment(uint8_t *p) · 39 unmodified lines | ||
| 557 | 557 | ST_FUNC uint8_t *parse_comment(uint8_t *p) |
| 558 | 558 | { |
| 559 | 559 | int c; |
| 560 | − | |
| 560 | + | |
| 561 | 561 | p++; |
| 562 | 562 | for(;;) { |
| 563 | 563 | /* fast skip loop */ |
| @@ -635,13 +635,13 @@ static inline void skip_spaces(void) · 71 unmodified lines | ||
| 635 | 635 | cinp(); |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | −static inline int check_space(int t, int *spc) | |
| 638 | +static inline int check_space(int t, int *spc) | |
| 639 | 639 | { |
| 640 | 640 | if (t < 256 && (isidnum_table[t - CH_EOF] & IS_SPC)) { |
| 641 | − if (*spc) | |
| 641 | + if (*spc) | |
| 642 | 642 | return 1; |
| 643 | 643 | *spc = 1; |
| 644 | − } else | |
| 644 | + } else | |
| 645 | 645 | *spc = 0; |
| 646 | 646 | return 0; |
| 647 | 647 | } |
| @@ -774,7 +774,7 @@ redo_start: · 126 unmodified lines | ||
| 774 | 774 | file->buf_ptr = p; |
| 775 | 775 | next_nomacro(); |
| 776 | 776 | p = file->buf_ptr; |
| 777 | − if (a == 0 && | |
| 777 | + if (a == 0 && | |
| 778 | 778 | (tok == TOK_ELSE || tok == TOK_ELIF || tok == TOK_ENDIF)) |
| 779 | 779 | goto the_end; |
| 780 | 780 | if (tok == TOK_IF || tok == TOK_IFDEF || tok == TOK_IFNDEF) |
| @@ -930,7 +930,7 @@ static void tok_str_add2(TokenString *s, int t, CValue *cv) · 149 unmodified lines | ||
| 930 | 930 | cstr->size = cv->cstr->size; |
| 931 | 931 | cstr->data_allocated = NULL; |
| 932 | 932 | cstr->size_allocated = cstr->size; |
| 933 | − memcpy((char *)cstr + sizeof(CString), | |
| 933 | + memcpy((char *)cstr + sizeof(CString), | |
| 934 | 934 | cv->cstr->data, cstr->size); |
| 935 | 935 | len += nb_words; |
| 936 | 936 | } |
| @@ -1253,14 +1253,14 @@ static int expr_preprocess(void) · 316 unmodified lines | ||
| 1253 | 1253 | { |
| 1254 | 1254 | int c, t; |
| 1255 | 1255 | TokenString str; |
| 1256 | − | |
| 1256 | + | |
| 1257 | 1257 | tok_str_new(&str); |
| 1258 | 1258 | while (tok != TOK_LINEFEED && tok != TOK_EOF) { |
| 1259 | 1259 | next(); /* do macro subst */ |
| 1260 | 1260 | if (tok == TOK_DEFINED) { |
| 1261 | 1261 | next_nomacro(); |
| 1262 | 1262 | t = tok; |
| 1263 | − if (t == '(') | |
| 1263 | + if (t == '(') | |
| 1264 | 1264 | next_nomacro(); |
| 1265 | 1265 | c = define_find(tok) != 0; |
| 1266 | 1266 | if (t == '(') |
| @@ -1914,7 +1914,7 @@ static void parse_escape_string(CString *outstr, const uint8_t *buf, int is_long · 647 unmodified lines | ||
| 1914 | 1914 | break; |
| 1915 | 1915 | case '\'': |
| 1916 | 1916 | case '\"': |
| 1917 | − case '\\': | |
| 1917 | + case '\\': | |
| 1918 | 1918 | case '?': |
| 1919 | 1919 | break; |
| 1920 | 1920 | default: |
| @@ -2070,7 +2070,7 @@ static void parse_number(const char *p) · 149 unmodified lines | ||
| 2070 | 2070 | *q = '\0'; |
| 2071 | 2071 | if (b == 16) |
| 2072 | 2072 | shift = 4; |
| 2073 | − else | |
| 2073 | + else | |
| 2074 | 2074 | shift = 1; |
| 2075 | 2075 | bn_zero(bn); |
| 2076 | 2076 | q = token_buf; |
| @@ -2126,7 +2126,7 @@ static void parse_number(const char *p) · 49 unmodified lines | ||
| 2126 | 2126 | ch = *p++; |
| 2127 | 2127 | } |
| 2128 | 2128 | exp_val = exp_val * s; |
| 2129 | − | |
| 2129 | + | |
| 2130 | 2130 | /* now we can generate the number */ |
| 2131 | 2131 | /* XXX: should patch directly float number */ |
| 2132 | 2132 | d = (double)bn[1] * 4294967296.0 + (double)bn[0]; |
| @@ -2363,7 +2363,7 @@ static inline void next_nomacro1(void) · 230 unmodified lines | ||
| 2363 | 2363 | } else { |
| 2364 | 2364 | tok_flags &= ~TOK_FLAG_EOF; |
| 2365 | 2365 | /* pop include file */ |
| 2366 | − | |
| 2366 | + | |
| 2367 | 2367 | /* test if previous '#endif' was after a #ifdef at |
| 2368 | 2368 | start of file */ |
| 2369 | 2369 | if (tok_flags & TOK_FLAG_ENDIF) { |
| @@ -2400,7 +2400,7 @@ maybe_newline: · 30 unmodified lines | ||
| 2400 | 2400 | case '#': |
| 2401 | 2401 | /* XXX: simplify */ |
| 2402 | 2402 | PEEKC(c, p); |
| 2403 | − if ((tok_flags & TOK_FLAG_BOL) && | |
| 2403 | + if ((tok_flags & TOK_FLAG_BOL) && | |
| 2404 | 2404 | (parse_flags & PARSE_FLAG_PREPROCESS)) { |
| 2405 | 2405 | file->buf_ptr = p; |
| 2406 | 2406 | preprocess(tok_flags & TOK_FLAG_BOF); |
| @@ -2420,7 +2420,7 @@ maybe_newline: · 13 unmodified lines | ||
| 2420 | 2420 | } |
| 2421 | 2421 | } |
| 2422 | 2422 | break; |
| 2423 | − | |
| 2423 | + | |
| 2424 | 2424 | /* dollar is allowed to start identifiers when not parsing asm */ |
| 2425 | 2425 | case '$': |
| 2426 | 2426 | if (!(isidnum_table[c - CH_EOF] & IS_ID) |
| @@ -2433,14 +2433,14 @@ maybe_newline: · 6 unmodified lines | ||
| 2433 | 2433 | case 'm': case 'n': case 'o': case 'p': |
| 2434 | 2434 | case 'q': case 'r': case 's': case 't': |
| 2435 | 2435 | case 'u': case 'v': case 'w': case 'x': |
| 2436 | − case 'y': case 'z': | |
| 2436 | + case 'y': case 'z': | |
| 2437 | 2437 | case 'A': case 'B': case 'C': case 'D': |
| 2438 | 2438 | case 'E': case 'F': case 'G': case 'H': |
| 2439 | − case 'I': case 'J': case 'K': | |
| 2439 | + case 'I': case 'J': case 'K': | |
| 2440 | 2440 | case 'M': case 'N': case 'O': case 'P': |
| 2441 | 2441 | case 'Q': case 'R': case 'S': case 'T': |
| 2442 | 2442 | case 'U': case 'V': case 'W': case 'X': |
| 2443 | − case 'Y': case 'Z': | |
| 2443 | + case 'Y': case 'Z': | |
| 2444 | 2444 | case '_': |
| 2445 | 2445 | parse_ident_fast: |
| 2446 | 2446 | p1 = p; |
| @@ -2594,7 +2594,7 @@ maybe_newline: · 147 unmodified lines | ||
| 2594 | 2594 | tok = TOK_GT; |
| 2595 | 2595 | } |
| 2596 | 2596 | break; |
| 2597 | − | |
| 2597 | + | |
| 2598 | 2598 | case '&': |
| 2599 | 2599 | PEEKC(c, p); |
| 2600 | 2600 | if (c == '&') { |
| @@ -2607,7 +2607,7 @@ maybe_newline: · 6 unmodified lines | ||
| 2607 | 2607 | tok = '&'; |
| 2608 | 2608 | } |
| 2609 | 2609 | break; |
| 2610 | − | |
| 2610 | + | |
| 2611 | 2611 | case '|': |
| 2612 | 2612 | PEEKC(c, p); |
| 2613 | 2613 | if (c == '|') { |
| @@ -2633,7 +2633,7 @@ maybe_newline: · 19 unmodified lines | ||
| 2633 | 2633 | tok = '+'; |
| 2634 | 2634 | } |
| 2635 | 2635 | break; |
| 2636 | − | |
| 2636 | + | |
| 2637 | 2637 | case '-': |
| 2638 | 2638 | PEEKC(c, p); |
| 2639 | 2639 | if (c == '-') { |
| @@ -2655,7 +2655,7 @@ maybe_newline: · 15 unmodified lines | ||
| 2655 | 2655 | PARSE2('*', '*', '=', TOK_A_MUL) |
| 2656 | 2656 | PARSE2('%', '%', '=', TOK_A_MOD) |
| 2657 | 2657 | PARSE2('^', '^', '=', TOK_A_XOR) |
| 2658 | − | |
| 2658 | + | |
| 2659 | 2659 | /* comments or operator */ |
| 2660 | 2660 | case '/': |
| 2661 | 2661 | PEEKC(c, p); |
| @@ -2675,7 +2675,7 @@ maybe_newline: · 13 unmodified lines | ||
| 2675 | 2675 | tok = '/'; |
| 2676 | 2676 | } |
| 2677 | 2677 | break; |
| 2678 | − | |
| 2678 | + | |
| 2679 | 2679 | /* simple tokens */ |
| 2680 | 2680 | case '(': |
| 2681 | 2681 | case ')': |
| @@ -2730,7 +2730,7 @@ ST_FUNC void next_nomacro(void) · 48 unmodified lines | ||
| 2730 | 2730 | next_nomacro_spc(); |
| 2731 | 2731 | } while (tok < 256 && (isidnum_table[tok - CH_EOF] & IS_SPC)); |
| 2732 | 2732 | } |
| 2733 | − | |
| 2733 | + | |
| 2734 | 2734 | |
| 2735 | 2735 | static void macro_subst( |
| 2736 | 2736 | TokenString *tok_str, |
| @@ -2924,7 +2924,7 @@ static int macro_subst_tok( · 187 unmodified lines | ||
| 2924 | 2924 | CValue cval; |
| 2925 | 2925 | CString cstr; |
| 2926 | 2926 | char buf[32]; |
| 2927 | − | |
| 2927 | + | |
| 2928 | 2928 | /* if symbol is a macro, prepare substitution */ |
| 2929 | 2929 | /* special macros */ |
| 2930 | 2930 | if (tok == TOK___LINE__) { |
| @@ -2942,10 +2942,10 @@ static int macro_subst_tok( · 11 unmodified lines | ||
| 2942 | 2942 | time(&ti); |
| 2943 | 2943 | tm = localtime(&ti); |
| 2944 | 2944 | if (tok == TOK___DATE__) { |
| 2945 | − snprintf(buf, sizeof(buf), "%s %2d %d", | |
| 2945 | + snprintf(buf, sizeof(buf), "%s %2d %d", | |
| 2946 | 2946 | ab_month_name[tm->tm_mon], tm->tm_mday, tm->tm_year + 1900); |
| 2947 | 2947 | } else { |
| 2948 | − snprintf(buf, sizeof(buf), "%02d:%02d:%02d", | |
| 2948 | + snprintf(buf, sizeof(buf), "%02d:%02d:%02d", | |
| 2949 | 2949 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 2950 | 2950 | } |
| 2951 | 2951 | cstrval = buf; |
| @@ -3010,8 +3010,8 @@ static int macro_subst_tok( · 58 unmodified lines | ||
| 3010 | 3010 | tok_str_new(&str); |
| 3011 | 3011 | parlevel = spc = 0; |
| 3012 | 3012 | /* NOTE: non zero sa->t indicates VA_ARGS */ |
| 3013 | − while ((parlevel > 0 || | |
| 3014 | − (tok != ')' && | |
| 3013 | + while ((parlevel > 0 || | |
| 3014 | + (tok != ')' && | |
| 3015 | 3015 | (tok != ',' || sa->type.t)))) { |
| 3016 | 3016 | if (tok == TOK_EOF || tok == 0) |
| 3017 | 3017 | break; |
| @@ -3143,7 +3143,7 @@ static inline int *macro_twosharps(const int *ptr0) · 125 unmodified lines | ||
| 3143 | 3143 | /* given 'a##b', remove nosubsts preceding 'b' */ |
| 3144 | 3144 | while ((t1 = *++ptr) == TOK_NOSUBST) |
| 3145 | 3145 | ; |
| 3146 | − if (t1 && t1 != TOK_TWOSHARPS | |
| 3146 | + if (t1 && t1 != TOK_TWOSHARPS | |
| 3147 | 3147 | && t1 != ':') /* 'a##:' don't build a new token */ |
| 3148 | 3148 | { |
| 3149 | 3149 | TOK_GET(&t1, &ptr, &cv1); |
| @@ -3181,7 +3181,7 @@ static void macro_subst( · 31 unmodified lines | ||
| 3181 | 3181 | int t, spc, nosubst; |
| 3182 | 3182 | CValue cval; |
| 3183 | 3183 | int *macro_str1 = NULL; |
| 3184 | − | |
| 3184 | + | |
| 3185 | 3185 | /* first scan for '##' operator handling */ |
| 3186 | 3186 | ptr = macro_str; |
| 3187 | 3187 | spc = nosubst = 0; |
| @@ -3334,7 +3334,7 @@ ST_FUNC void preprocess_new(void) · 146 unmodified lines | ||
| 3334 | 3334 | : 0; |
| 3335 | 3335 | |
| 3336 | 3336 | memset(hash_ident, 0, TOK_HASH_SIZE * sizeof(TokenSym *)); |
| 3337 | − | |
| 3337 | + | |
| 3338 | 3338 | tok_ident = TOK_IDENT; |
| 3339 | 3339 | p = tcc_keywords; |
| 3340 | 3340 | while (*p) { |
| @@ -36,7 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | DEF(TOK_RESTRICT2, "__restrict") |
| 37 | 37 | DEF(TOK_RESTRICT3, "__restrict__") |
| 38 | 38 | DEF(TOK_EXTENSION, "__extension__") /* gcc keyword */ |
| 39 | − | |
| 39 | + | |
| 40 | 40 | DEF(TOK_FLOAT, "float") |
| 41 | 41 | DEF(TOK_DOUBLE, "double") |
| 42 | 42 | DEF(TOK_BOOL, "_Bool") |
| @@ -41,7 +41,7 @@ static int run_callback(const char *src, callback_type callback) { · 40 unmodified lines | ||
| 41 | 41 | TCCState *s; |
| 42 | 42 | int result; |
| 43 | 43 | void *ptr; |
| 44 | − | |
| 44 | + | |
| 45 | 45 | s = tcc_new(); |
| 46 | 46 | if (!s) |
| 47 | 47 | return -1; |
| @@ -54,14 +54,14 @@ static int run_callback(const char *src, callback_type callback) { · 6 unmodified lines | ||
| 54 | 54 | return -1; |
| 55 | 55 | if (tcc_relocate(s, TCC_RELOCATE_AUTO) == -1) |
| 56 | 56 | return -1; |
| 57 | − | |
| 57 | + | |
| 58 | 58 | ptr = tcc_get_symbol(s, "f"); |
| 59 | 59 | if (!ptr) |
| 60 | 60 | return -1; |
| 61 | 61 | result = callback(ptr); |
| 62 | − | |
| 62 | + | |
| 63 | 63 | tcc_delete(s); |
| 64 | − | |
| 64 | + | |
| 65 | 65 | return result; |
| 66 | 66 | } |
| 67 | 67 | |
| @@ -89,7 +89,7 @@ RET_PRIMITIVE_TEST(longdouble, LONG_DOUBLE, LONG_DOUBLE_LITERAL(378943892.0)) · 21 unmodified lines | ||
| 89 | 89 | |
| 90 | 90 | /* |
| 91 | 91 | * ret_2float_test: |
| 92 | − * | |
| 92 | + * | |
| 93 | 93 | * On x86-64, a struct with 2 floats should be packed into a single |
| 94 | 94 | * SSE register (VT_DOUBLE is used for this purpose). |
| 95 | 95 | */ |
| @@ -117,7 +117,7 @@ static int ret_2float_test(void) { · 21 unmodified lines | ||
| 117 | 117 | |
| 118 | 118 | /* |
| 119 | 119 | * ret_2double_test: |
| 120 | − * | |
| 120 | + * | |
| 121 | 121 | * On x86-64, a struct with 2 doubles should be passed in two SSE |
| 122 | 122 | * registers. |
| 123 | 123 | */ |
| @@ -281,7 +281,7 @@ static int reg_pack_test(void) { · 157 unmodified lines | ||
| 281 | 281 | " reg_pack_test_type r = {a.x*5, a.y*3};\n" |
| 282 | 282 | " return r;\n" |
| 283 | 283 | "}\n"; |
| 284 | − | |
| 284 | + | |
| 285 | 285 | return run_callback(src, reg_pack_test_callback); |
| 286 | 286 | } |
| 287 | 287 | |
| @@ -307,7 +307,7 @@ static int reg_pack_longlong_test(void) { · 19 unmodified lines | ||
| 307 | 307 | " reg_pack_longlong_test_type r = {a.x*5, a.y*3};\n" |
| 308 | 308 | " return r;\n" |
| 309 | 309 | "}\n"; |
| 310 | − | |
| 310 | + | |
| 311 | 311 | return run_callback(src, reg_pack_longlong_test_callback); |
| 312 | 312 | } |
| 313 | 313 | |
| @@ -365,13 +365,13 @@ static int sret_test(void) { · 51 unmodified lines | ||
| 365 | 365 | " sret_test_type r = {x.a*35, x.b*19, x.c*21};\n" |
| 366 | 366 | " return r;\n" |
| 367 | 367 | "}\n"; |
| 368 | − | |
| 368 | + | |
| 369 | 369 | return run_callback(src, sret_test_callback); |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | /* |
| 373 | 373 | * one_member_union_test: |
| 374 | − * | |
| 374 | + * | |
| 375 | 375 | * In the x86-64 ABI a union should always be passed on the stack. However |
| 376 | 376 | * it appears that a single member union is treated by GCC as its member. |
| 377 | 377 | */ |
| @@ -399,7 +399,7 @@ static int one_member_union_test(void) { · 21 unmodified lines | ||
| 399 | 399 | |
| 400 | 400 | /* |
| 401 | 401 | * two_member_union_test: |
| 402 | − * | |
| 402 | + * | |
| 403 | 403 | * In the x86-64 ABI a union should always be passed on the stack. |
| 404 | 404 | */ |
| 405 | 405 | typedef union two_member_union_test_type_u {int x; long y;} two_member_union_test_type; |
| @@ -430,7 +430,7 @@ static int two_member_union_test(void) { · 24 unmodified lines | ||
| 430 | 430 | |
| 431 | 431 | typedef struct many_struct_test_type_s {long long a, b, c;} many_struct_test_type; |
| 432 | 432 | typedef many_struct_test_type (*many_struct_test_function_type) (many_struct_test_type,many_struct_test_type,many_struct_test_type,many_struct_test_type,many_struct_test_type,many_struct_test_type); |
| 433 | − | |
| 433 | + | |
| 434 | 434 | static int many_struct_test_callback(void *ptr) { |
| 435 | 435 | many_struct_test_function_type f = (many_struct_test_function_type)ptr; |
| 436 | 436 | many_struct_test_type v = {1, 2, 3}; |
| @@ -457,7 +457,7 @@ static int many_struct_test(void) { · 20 unmodified lines | ||
| 457 | 457 | |
| 458 | 458 | typedef struct many_struct_test_2_type_s {int a, b;} many_struct_test_2_type; |
| 459 | 459 | typedef many_struct_test_2_type (*many_struct_test_2_function_type) (many_struct_test_2_type,many_struct_test_2_type,many_struct_test_2_type,many_struct_test_2_type,many_struct_test_2_type,many_struct_test_2_type); |
| 460 | − | |
| 460 | + | |
| 461 | 461 | static int many_struct_test_2_callback(void *ptr) { |
| 462 | 462 | many_struct_test_2_function_type f = (many_struct_test_2_function_type)ptr; |
| 463 | 463 | many_struct_test_2_type v = {1,2}; |
| @@ -598,7 +598,7 @@ static int arg_align_test_callback(void *ptr) { · 134 unmodified lines | ||
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | static int arg_align_test(void) { |
| 601 | − const char *src = | |
| 601 | + const char *src = | |
| 602 | 602 | "long double f(long double a, int b, long double c, int d, long double e) {\n" |
| 603 | 603 | " return a + c + e;\n" |
| 604 | 604 | "}\n"; |
| @@ -621,7 +621,7 @@ int main(int argc, char **argv) { · 16 unmodified lines | ||
| 621 | 621 | int i; |
| 622 | 622 | const char *testname = NULL; |
| 623 | 623 | int retval = EXIT_SUCCESS; |
| 624 | − | |
| 624 | + | |
| 625 | 625 | /* if tcclib.h and libtcc1.a are not installed, where can we find them */ |
| 626 | 626 | for (i = 1; i < argc; ++i) { |
| 627 | 627 | if (!memcmp(argv[i], "run_test=", 9)) |
| @@ -320,7 +320,7 @@ void macro_test(void) · 319 unmodified lines | ||
| 320 | 320 | #line 200 |
| 321 | 321 | printf("__LINE__=%d __FILE__=%s\n", |
| 322 | 322 | __LINE__, __FILE__); |
| 323 | −#line 203 "test" | |
| 323 | +#line 203 "test" | |
| 324 | 324 | printf("__LINE__=%d __FILE__=%s\n", |
| 325 | 325 | __LINE__, __FILE__); |
| 326 | 326 | #line 227 "tcctest.c" |
| @@ -348,7 +348,7 @@ void macro_test(void) · 21 unmodified lines | ||
| 348 | 348 | glue(a <, <= 2); |
| 349 | 349 | printf("a=%d\n", a); |
| 350 | 350 | } |
| 351 | − | |
| 351 | + | |
| 352 | 352 | /* macro function with argument outside the macro string */ |
| 353 | 353 | #define MF_s MF_hello |
| 354 | 354 | #define MF_hello(msg) printf("%s\n",msg) |
| @@ -357,7 +357,7 @@ void macro_test(void) · 2 unmodified lines | ||
| 357 | 357 | |
| 358 | 358 | MF_s("hi"); |
| 359 | 359 | MF_t("hi"); |
| 360 | − | |
| 360 | + | |
| 361 | 361 | /* test macro substituion inside args (should not eat stream) */ |
| 362 | 362 | printf("qq=%d\n", qq(qq)(2)); |
| 363 | 363 | |
| @@ -398,7 +398,7 @@ void recursive_macro_test(void) · 34 unmodified lines | ||
| 398 | 398 | printf("%d\n", ELFW(ST_INFO)(STB_WEAK, ELFW(ST_TYPE)(123))); |
| 399 | 399 | |
| 400 | 400 | #define WRAP(x) x |
| 401 | − | |
| 401 | + | |
| 402 | 402 | #define print_num(x) print_num(__FILE__,__LINE__,x) |
| 403 | 403 | print_num(123); |
| 404 | 404 | WRAP(print_num(123)); |
| @@ -537,7 +537,7 @@ void goto_test() · 132 unmodified lines | ||
| 537 | 537 | /* This needs to parse as label, not as start of decl. */ |
| 538 | 538 | typedef_and_label: |
| 539 | 539 | s_loop: |
| 540 | − if (i >= 10) | |
| 540 | + if (i >= 10) | |
| 541 | 541 | goto s_end; |
| 542 | 542 | printf("%d", i); |
| 543 | 543 | i++; |
| @@ -688,7 +688,7 @@ int main(int argc, char **argv) · 144 unmodified lines | ||
| 688 | 688 | callsave_test(); |
| 689 | 689 | builtin_frame_address_test(); |
| 690 | 690 | intdiv_test(); |
| 691 | − return 0; | |
| 691 | + return 0; | |
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | int tab[3]; |
| @@ -797,10 +797,10 @@ void expr_test() · 102 unmodified lines | ||
| 797 | 797 | printf("%d\n", ~12); |
| 798 | 798 | printf("%d\n", -12); |
| 799 | 799 | printf("%d\n", +12); |
| 800 | − printf("%d %d %d %d\n", | |
| 801 | − isid('a'), | |
| 802 | − isid('g'), | |
| 803 | − isid('T'), | |
| 800 | + printf("%d %d %d %d\n", | |
| 801 | + isid('a'), | |
| 802 | + isid('g'), | |
| 803 | + isid('T'), | |
| 804 | 804 | isid('(')); |
| 805 | 805 | } |
| 806 | 806 | |
| @@ -984,7 +984,7 @@ void struct_test() · 177 unmodified lines | ||
| 984 | 984 | sizeof(struct aligntest3), __alignof__(struct aligntest3)); |
| 985 | 985 | printf("aligntest4 sizeof=%d alignof=%d\n", |
| 986 | 986 | sizeof(struct aligntest4), __alignof__(struct aligntest4)); |
| 987 | − | |
| 987 | + | |
| 988 | 988 | /* empty structures (GCC extension) */ |
| 989 | 989 | printf("sizeof(struct empty) = %d\n", sizeof(struct empty)); |
| 990 | 990 | printf("alignof(struct empty) = %d\n", __alignof__(struct empty)); |
| @@ -999,17 +999,17 @@ void char_short_test() · 8 unmodified lines | ||
| 999 | 999 | |
| 1000 | 1000 | var1 = 0x01020304; |
| 1001 | 1001 | var2 = 0xfffefdfc; |
| 1002 | − printf("s8=%d %d\n", | |
| 1002 | + printf("s8=%d %d\n", | |
| 1003 | 1003 | *(char *)&var1, *(char *)&var2); |
| 1004 | − printf("u8=%d %d\n", | |
| 1004 | + printf("u8=%d %d\n", | |
| 1005 | 1005 | *(unsigned char *)&var1, *(unsigned char *)&var2); |
| 1006 | − printf("s16=%d %d\n", | |
| 1006 | + printf("s16=%d %d\n", | |
| 1007 | 1007 | *(short *)&var1, *(short *)&var2); |
| 1008 | − printf("u16=%d %d\n", | |
| 1008 | + printf("u16=%d %d\n", | |
| 1009 | 1009 | *(unsigned short *)&var1, *(unsigned short *)&var2); |
| 1010 | − printf("s32=%d %d\n", | |
| 1010 | + printf("s32=%d %d\n", | |
| 1011 | 1011 | *(int *)&var1, *(int *)&var2); |
| 1012 | − printf("u32=%d %d\n", | |
| 1012 | + printf("u32=%d %d\n", | |
| 1013 | 1013 | *(unsigned int *)&var1, *(unsigned int *)&var2); |
| 1014 | 1014 | *(char *)&var1 = 0x08; |
| 1015 | 1015 | printf("var1=%x\n", var1); |
| @@ -1099,7 +1099,7 @@ void bool_test() · 83 unmodified lines | ||
| 1099 | 1099 | static int v1 = 34 ? : -1; /* constant case */ |
| 1100 | 1100 | static int v2 = 0 ? : -1; /* constant case */ |
| 1101 | 1101 | int a = 30; |
| 1102 | − | |
| 1102 | + | |
| 1103 | 1103 | printf("%d %d\n", v1, v2); |
| 1104 | 1104 | printf("%d %d\n", a - 30 ? : a * 2, a + 1 ? : a * 2); |
| 1105 | 1105 | } |
| @@ -1116,8 +1116,8 @@ static int tab_reinit[]; · 10 unmodified lines | ||
| 1116 | 1116 | static int tab_reinit[10]; |
| 1117 | 1117 | |
| 1118 | 1118 | //int cinit1; /* a global variable can be defined several times without error ! */ |
| 1119 | −int cinit1; | |
| 1120 | −int cinit1; | |
| 1119 | +int cinit1; | |
| 1120 | +int cinit1; | |
| 1121 | 1121 | int cinit1 = 0; |
| 1122 | 1122 | int *cinit2 = (int []){3, 2, 1}; |
| 1123 | 1123 | |
| @@ -1157,7 +1157,7 @@ void compound_literal_test(void) · 33 unmodified lines | ||
| 1157 | 1157 | |
| 1158 | 1158 | for(i=0;i<3;i++) { |
| 1159 | 1159 | p = (int []){1, 2, 4 + i}; |
| 1160 | − printf("%d %d %d\n", | |
| 1160 | + printf("%d %d %d\n", | |
| 1161 | 1161 | p[0], |
| 1162 | 1162 | p[1], |
| 1163 | 1163 | p[2]); |
| @@ -1188,7 +1188,7 @@ kr_test() · 24 unmodified lines | ||
| 1188 | 1188 | void num(int n) |
| 1189 | 1189 | { |
| 1190 | 1190 | char *tab, *p; |
| 1191 | − tab = (char*)malloc(20); | |
| 1191 | + tab = (char*)malloc(20); | |
| 1192 | 1192 | p = tab; |
| 1193 | 1193 | while (1) { |
| 1194 | 1194 | *p = 48 + (n % 10); |
| @@ -1231,7 +1231,7 @@ void struct_assign_test(void) · 36 unmodified lines | ||
| 1231 | 1231 | struct structa1 lsta1, lsta2; |
| 1232 | 1232 | int i; |
| 1233 | 1233 | } s, *ps; |
| 1234 | − | |
| 1234 | + | |
| 1235 | 1235 | ps = &s; |
| 1236 | 1236 | ps->i = 4; |
| 1237 | 1237 | #if 0 |
| @@ -1247,7 +1247,7 @@ void struct_assign_test(void) · 9 unmodified lines | ||
| 1247 | 1247 | s.lsta2.f2 = 2; |
| 1248 | 1248 | #endif |
| 1249 | 1249 | struct_assign_test1(ps->lsta2, 3, 4.5); |
| 1250 | − | |
| 1250 | + | |
| 1251 | 1251 | printf("before call: %d %d\n", s.lsta2.f1, s.lsta2.f2); |
| 1252 | 1252 | ps->lsta2 = struct_assign_test2(ps->lsta2, ps->i); |
| 1253 | 1253 | printf("after call: %d %d\n", ps->lsta2.f1, ps->lsta2.f2); |
| @@ -1300,9 +1300,9 @@ void cast_test() · 46 unmodified lines | ||
| 1300 | 1300 | printf("%d\n", a); |
| 1301 | 1301 | a = (scast = 65536) + 1; |
| 1302 | 1302 | printf("%d\n", a); |
| 1303 | − | |
| 1303 | + | |
| 1304 | 1304 | printf("sizeof(c) = %d, sizeof((int)c) = %d\n", sizeof(c), sizeof((int)c)); |
| 1305 | − | |
| 1305 | + | |
| 1306 | 1306 | /* test cast from unsigned to signed short to int */ |
| 1307 | 1307 | b = 0xf000; |
| 1308 | 1308 | d = (short)b; |
| @@ -1310,7 +1310,7 @@ void cast_test() · 1 unmodified line | ||
| 1310 | 1310 | b = 0xf0f0; |
| 1311 | 1311 | d = (char)b; |
| 1312 | 1312 | printf("((unsigned)(char)0x%08x) = 0x%08x\n", b, d); |
| 1313 | − | |
| 1313 | + | |
| 1314 | 1314 | /* test implicit int casting for array accesses */ |
| 1315 | 1315 | c = 0; |
| 1316 | 1316 | tab[1] = 2; |
| @@ -1352,7 +1352,7 @@ char sinit8[] = "hello" "trala"; · 35 unmodified lines | ||
| 1352 | 1352 | |
| 1353 | 1353 | struct structinit1 sinit9 = { 1, 2, 3 }; |
| 1354 | 1354 | struct structinit1 sinit10 = { .f2 = 2, 3, .f1 = 1 }; |
| 1355 | −struct structinit1 sinit11 = { .f2 = 2, 3, .f1 = 1, | |
| 1355 | +struct structinit1 sinit11 = { .f2 = 2, 3, .f1 = 1, | |
| 1356 | 1356 | #ifdef ALL_ISOC99 |
| 1357 | 1357 | .farray[0] = 10, |
| 1358 | 1358 | .farray[1] = 11, |
| @@ -1437,36 +1437,36 @@ void init_test(void) · 78 unmodified lines | ||
| 1437 | 1437 | int linit15[10] = { linit1, linit1 + 1, [6] = linit1 + 2, }; |
| 1438 | 1438 | struct linit16 { int a1, a2, a3, a4; } linit16 = { 1, .a3 = 2 }; |
| 1439 | 1439 | int linit17 = sizeof(linit17); |
| 1440 | − | |
| 1440 | + | |
| 1441 | 1441 | printf("init_test:\n"); |
| 1442 | 1442 | |
| 1443 | 1443 | printf("sinit1=%d\n", sinit1); |
| 1444 | 1444 | printf("sinit2=%d\n", sinit2); |
| 1445 | − printf("sinit3=%d %d %d %d\n", | |
| 1445 | + printf("sinit3=%d %d %d %d\n", | |
| 1446 | 1446 | sizeof(sinit3), |
| 1447 | 1447 | sinit3[0], |
| 1448 | 1448 | sinit3[1], |
| 1449 | 1449 | sinit3[2] |
| 1450 | 1450 | ); |
| 1451 | 1451 | printf("sinit6=%d\n", sizeof(sinit6)); |
| 1452 | − printf("sinit7=%d %d %d %d\n", | |
| 1452 | + printf("sinit7=%d %d %d %d\n", | |
| 1453 | 1453 | sizeof(sinit7), |
| 1454 | 1454 | sinit7[0], |
| 1455 | 1455 | sinit7[1], |
| 1456 | 1456 | sinit7[2] |
| 1457 | 1457 | ); |
| 1458 | 1458 | printf("sinit8=%s\n", sinit8); |
| 1459 | − printf("sinit9=%d %d %d\n", | |
| 1459 | + printf("sinit9=%d %d %d\n", | |
| 1460 | 1460 | sinit9.f1, |
| 1461 | 1461 | sinit9.f2, |
| 1462 | 1462 | sinit9.f3 |
| 1463 | 1463 | ); |
| 1464 | − printf("sinit10=%d %d %d\n", | |
| 1464 | + printf("sinit10=%d %d %d\n", | |
| 1465 | 1465 | sinit10.f1, |
| 1466 | 1466 | sinit10.f2, |
| 1467 | 1467 | sinit10.f3 |
| 1468 | 1468 | ); |
| 1469 | − printf("sinit11=%d %d %d %d %d %d\n", | |
| 1469 | + printf("sinit11=%d %d %d %d %d %d\n", | |
| 1470 | 1470 | sinit11.f1, |
| 1471 | 1471 | sinit11.f2, |
| 1472 | 1472 | sinit11.f3, |
| @@ -1477,7 +1477,7 @@ void init_test(void) · 4 unmodified lines | ||
| 1477 | 1477 | |
| 1478 | 1478 | for(i=0;i<3;i++) |
| 1479 | 1479 | for(j=0;j<2;j++) |
| 1480 | − printf("[%d][%d] = %d %d %d\n", | |
| 1480 | + printf("[%d][%d] = %d %d %d\n", | |
| 1481 | 1481 | i, j, sinit4[i][j], sinit5[i][j], linit4[i][j]); |
| 1482 | 1482 | printf("linit1=%d\n", linit1); |
| 1483 | 1483 | printf("linit2=%d\n", linit2); |
| @@ -1486,7 +1486,7 @@ void init_test(void) · 2 unmodified lines | ||
| 1486 | 1486 | |
| 1487 | 1487 | printf("sinit12=%s\n", sinit12); |
| 1488 | 1488 | printf("sinit13=%d %s %s %s\n", |
| 1489 | − sizeof(sinit13), | |
| 1489 | + sizeof(sinit13), | |
| 1490 | 1490 | sinit13[0], |
| 1491 | 1491 | sinit13[1], |
| 1492 | 1492 | sinit13[2]); |
| @@ -1500,7 +1500,7 @@ void init_test(void) · 7 unmodified lines | ||
| 1500 | 1500 | printf("\n"); |
| 1501 | 1501 | for(i=0;i<10;i++) printf(" %d", linit15[i]); |
| 1502 | 1502 | printf("\n"); |
| 1503 | − printf("%d %d %d %d\n", | |
| 1503 | + printf("%d %d %d %d\n", | |
| 1504 | 1504 | linit16.a1, |
| 1505 | 1505 | linit16.a2, |
| 1506 | 1506 | linit16.a3, |
| @@ -1599,13 +1599,13 @@ void bitfield_test(void) · 92 unmodified lines | ||
| 1599 | 1599 | printf("%d %d\n", sa, ca); |
| 1600 | 1600 | |
| 1601 | 1601 | st1.f1 = 7; |
| 1602 | − if (st1.f1 == -1) | |
| 1602 | + if (st1.f1 == -1) | |
| 1603 | 1603 | printf("st1.f1 == -1\n"); |
| 1604 | − else | |
| 1604 | + else | |
| 1605 | 1605 | printf("st1.f1 != -1\n"); |
| 1606 | − if (st1.f2 == -1) | |
| 1606 | + if (st1.f2 == -1) | |
| 1607 | 1607 | printf("st1.f2 == -1\n"); |
| 1608 | − else | |
| 1608 | + else | |
| 1609 | 1609 | printf("st1.f2 != -1\n"); |
| 1610 | 1610 | |
| 1611 | 1611 | /* bit sizes below must be bigger than 32 since GCC doesn't allow |
| @@ -1835,7 +1835,7 @@ void lloptest(long long a, long long b) · 223 unmodified lines | ||
| 1835 | 1835 | a + b, |
| 1836 | 1836 | a - b, |
| 1837 | 1837 | a * b); |
| 1838 | − | |
| 1838 | + | |
| 1839 | 1839 | if (b != 0) { |
| 1840 | 1840 | printf("arith1: " LONG_LONG_FORMAT " " LONG_LONG_FORMAT "\n", |
| 1841 | 1841 | a / b, |
| @@ -1856,7 +1856,7 @@ void lloptest(long long a, long long b) · 14 unmodified lines | ||
| 1856 | 1856 | a > b, |
| 1857 | 1857 | a >= b, |
| 1858 | 1858 | a <= b); |
| 1859 | − | |
| 1859 | + | |
| 1860 | 1860 | printf("utest: %d %d %d %d %d %d\n", |
| 1861 | 1861 | ua == ub, |
| 1862 | 1862 | ua != ub, |
| @@ -1932,7 +1932,7 @@ long long llfunc1(int a) · 69 unmodified lines | ||
| 1932 | 1932 | } |
| 1933 | 1933 | |
| 1934 | 1934 | struct S { |
| 1935 | − int id; | |
| 1935 | + int id; | |
| 1936 | 1936 | char item; |
| 1937 | 1937 | }; |
| 1938 | 1938 | |
| @@ -1953,8 +1953,8 @@ void longlong_test(void) · 14 unmodified lines | ||
| 1953 | 1953 | a = ia; |
| 1954 | 1954 | b = ua; |
| 1955 | 1955 | printf(LONG_LONG_FORMAT " " LONG_LONG_FORMAT "\n", a, b); |
| 1956 | − printf(LONG_LONG_FORMAT " " LONG_LONG_FORMAT " " LONG_LONG_FORMAT " %Lx\n", | |
| 1957 | − (long long)1, | |
| 1956 | + printf(LONG_LONG_FORMAT " " LONG_LONG_FORMAT " " LONG_LONG_FORMAT " %Lx\n", | |
| 1957 | + (long long)1, | |
| 1958 | 1958 | (long long)-2, |
| 1959 | 1959 | 1LL, |
| 1960 | 1960 | 0x1234567812345679); |
| @@ -2049,7 +2049,7 @@ void vprintf1(const char *fmt, ...) · 88 unmodified lines | ||
| 2049 | 2049 | |
| 2050 | 2050 | va_start(aq, fmt); |
| 2051 | 2051 | va_copy(ap, aq); |
| 2052 | − | |
| 2052 | + | |
| 2053 | 2053 | p = fmt; |
| 2054 | 2054 | for(;;) { |
| 2055 | 2055 | c = *p; |
| @@ -2250,10 +2250,10 @@ void c99_vla_test(int size1, int size2) · 194 unmodified lines | ||
| 2250 | 2250 | int tab1[size][2], tab2[10][2]; |
| 2251 | 2251 | void *tab1_ptr, *tab2_ptr, *bad_ptr; |
| 2252 | 2252 | |
| 2253 | − /* "size" should have been 'captured' at tab1 declaration, | |
| 2253 | + /* "size" should have been 'captured' at tab1 declaration, | |
| 2254 | 2254 | so modifying it should have no effect on VLA behaviour. */ |
| 2255 | 2255 | size = size-1; |
| 2256 | − | |
| 2256 | + | |
| 2257 | 2257 | printf("Test C99 VLA 1 (sizeof): "); |
| 2258 | 2258 | printf("%s\n", (sizeof tab1 == size1 * size2 * 2 * sizeof(int)) ? "PASSED" : "FAILED"); |
| 2259 | 2259 | tab1_ptr = tab1; |
| @@ -2325,7 +2325,7 @@ void sizeof_test(void) · 65 unmodified lines | ||
| 2325 | 2325 | t <<= 16; |
| 2326 | 2326 | t <<= 16; |
| 2327 | 2327 | t++; |
| 2328 | − /* This checks that sizeof really can be used to manipulate | |
| 2328 | + /* This checks that sizeof really can be used to manipulate | |
| 2329 | 2329 | uintptr_t objects, without truncation. */ |
| 2330 | 2330 | t2 = t & -sizeof(uintptr_t); |
| 2331 | 2331 | printf ("%lu %lu\n", t, t2); |
| @@ -2358,15 +2358,15 @@ void statement_expr_test(void) · 26 unmodified lines | ||
| 2358 | 2358 | |
| 2359 | 2359 | a = 0; |
| 2360 | 2360 | for(i=0;i<10;i++) { |
| 2361 | − a += 1 + | |
| 2362 | − ( { int b, j; | |
| 2363 | − b = 0; | |
| 2364 | − for(j=0;j<5;j++) | |
| 2365 | − b += j; b; | |
| 2361 | + a += 1 + | |
| 2362 | + ( { int b, j; | |
| 2363 | + b = 0; | |
| 2364 | + for(j=0;j<5;j++) | |
| 2365 | + b += j; b; | |
| 2366 | 2366 | } ); |
| 2367 | 2367 | } |
| 2368 | 2368 | printf("a=%d\n", a); |
| 2369 | − | |
| 2369 | + | |
| 2370 | 2370 | } |
| 2371 | 2371 | |
| 2372 | 2372 | void local_label_test(void) |
| @@ -2589,7 +2589,7 @@ void builtin_test(void) · 216 unmodified lines | ||
| 2589 | 2589 | COMPAT_TYPE(char *, signed char *); |
| 2590 | 2590 | COMPAT_TYPE(char *, char *); |
| 2591 | 2591 | /* space is needed because tcc preprocessor introduces a space between each token */ |
| 2592 | − COMPAT_TYPE(char * *, void *); | |
| 2592 | + COMPAT_TYPE(char * *, void *); | |
| 2593 | 2593 | #endif |
| 2594 | 2594 | printf("res = %d\n", __builtin_constant_p(1)); |
| 2595 | 2595 | printf("res = %d\n", __builtin_constant_p(1 + 2)); |
| @@ -2640,7 +2640,7 @@ void __attribute__((weak)) weak_test(void) · 44 unmodified lines | ||
| 2640 | 2640 | printf("weak_fpa=%d\n",&weak_fpa ? weak_fpa() : 123); |
| 2641 | 2641 | printf("weak_fpb=%d\n",&weak_fpb ? weak_fpb() : 123); |
| 2642 | 2642 | printf("weak_fpc=%d\n",&weak_fpc ? weak_fpc() : 123); |
| 2643 | − | |
| 2643 | + | |
| 2644 | 2644 | printf("weak_asm_f1=%d\n", weak_asm_f1 != NULL); |
| 2645 | 2645 | printf("weak_asm_f2=%d\n", weak_asm_f2 != NULL); |
| 2646 | 2646 | printf("weak_asm_f3=%d\n", weak_asm_f3 != NULL); |
| @@ -229,7 +229,7 @@ while(<$inf>) { · 228 unmodified lines | ||
| 229 | 229 | $inf = gensym(); |
| 230 | 230 | |
| 231 | 231 | # Try cwd and $ibase. |
| 232 | − open($inf, "<" . $1) | |
| 232 | + open($inf, "<" . $1) | |
| 233 | 233 | or open($inf, "<" . $ibase . "/" . $1) |
| 234 | 234 | or die "cannot open $1 or $ibase/$1: $!\n"; |
| 235 | 235 | next; |
| @@ -681,7 +681,7 @@ ST_FUNC void gen_bounded_ptr_add(void) · 680 unmodified lines | ||
| 681 | 681 | |
| 682 | 682 | |
| 683 | 683 | /* relocation offset of the bounding function call point */ |
| 684 | − vtop->c.ull = (cur_text_section->reloc->data_offset - sizeof(ElfW(Rela))); | |
| 684 | + vtop->c.ull = (cur_text_section->reloc->data_offset - sizeof(ElfW(Rela))); | |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | /* patch pointer addition in vtop so that pointer dereferencing is |
| @@ -823,7 +823,7 @@ void gfunc_call(int nb_args) · 135 unmodified lines | ||
| 823 | 823 | struct_size = args_size; |
| 824 | 824 | for(i = 0; i < nb_args; i++) { |
| 825 | 825 | SValue *sv; |
| 826 | − | |
| 826 | + | |
| 827 | 827 | --arg; |
| 828 | 828 | sv = &vtop[-i]; |
| 829 | 829 | bt = (sv->type.t & VT_BTYPE); |
| @@ -897,7 +897,7 @@ void gfunc_call(int nb_args) · 67 unmodified lines | ||
| 897 | 897 | vtop->type.t = size > 4 ? VT_LLONG : size > 2 ? VT_INT |
| 898 | 898 | : size > 1 ? VT_SHORT : VT_BYTE; |
| 899 | 899 | } |
| 900 | − | |
| 900 | + | |
| 901 | 901 | r = gv(RC_INT); |
| 902 | 902 | if (arg >= REGN) { |
| 903 | 903 | gen_offs_sp(0x89, r, arg*8); |
| @@ -911,7 +911,7 @@ void gfunc_call(int nb_args) · 7 unmodified lines | ||
| 911 | 911 | vtop--; |
| 912 | 912 | } |
| 913 | 913 | save_regs(0); |
| 914 | − | |
| 914 | + | |
| 915 | 915 | /* Copy R10 and R11 into RCX and RDX, respectively */ |
| 916 | 916 | if (nb_args > 0) { |
| 917 | 917 | o(0xd1894c); /* mov %r10, %rcx */ |
| @@ -919,7 +919,7 @@ void gfunc_call(int nb_args) · 1 unmodified line | ||
| 919 | 919 | o(0xda894c); /* mov %r11, %rdx */ |
| 920 | 920 | } |
| 921 | 921 | } |
| 922 | − | |
| 922 | + | |
| 923 | 923 | gcall_or_jmp(0); |
| 924 | 924 | vtop--; |
| 925 | 925 | } |
| @@ -1072,10 +1072,10 @@ static X86_64_Mode classify_x86_64_inner(CType *ty, int offset, int start, int e · 146 unmodified lines | ||
| 1072 | 1072 | { |
| 1073 | 1073 | X86_64_Mode mode; |
| 1074 | 1074 | Sym *f; |
| 1075 | − | |
| 1075 | + | |
| 1076 | 1076 | switch (ty->t & VT_BTYPE) { |
| 1077 | 1077 | case VT_VOID: return x86_64_mode_none; |
| 1078 | − | |
| 1078 | + | |
| 1079 | 1079 | case VT_INT: |
| 1080 | 1080 | case VT_BYTE: |
| 1081 | 1081 | case VT_SHORT: |
| @@ -1084,12 +1084,12 @@ static X86_64_Mode classify_x86_64_inner(CType *ty, int offset, int start, int e · 2 unmodified lines | ||
| 1084 | 1084 | case VT_PTR: |
| 1085 | 1085 | case VT_FUNC: |
| 1086 | 1086 | case VT_ENUM: return x86_64_mode_integer; |
| 1087 | − | |
| 1087 | + | |
| 1088 | 1088 | case VT_FLOAT: |
| 1089 | 1089 | case VT_DOUBLE: return x86_64_mode_sse; |
| 1090 | − | |
| 1090 | + | |
| 1091 | 1091 | case VT_LDOUBLE: return x86_64_mode_x87; |
| 1092 | − | |
| 1092 | + | |
| 1093 | 1093 | case VT_STRUCT: |
| 1094 | 1094 | f = ty->ref; |
| 1095 | 1095 | |
| @@ -1098,10 +1098,10 @@ static X86_64_Mode classify_x86_64_inner(CType *ty, int offset, int start, int e · 2 unmodified lines | ||
| 1098 | 1098 | if (f->c + offset >= start && f->c + offset < end) |
| 1099 | 1099 | mode = classify_x86_64_merge(mode, classify_x86_64_inner(&f->type, f->c + offset, start, end)); |
| 1100 | 1100 | } |
| 1101 | − | |
| 1101 | + | |
| 1102 | 1102 | return mode; |
| 1103 | 1103 | } |
| 1104 | − | |
| 1104 | + | |
| 1105 | 1105 | assert(0); |
| 1106 | 1106 | } |
| 1107 | 1107 | |
| @@ -1305,7 +1305,7 @@ void gfunc_call(int nb_args) · 197 unmodified lines | ||
| 1305 | 1305 | args_size = 0; |
| 1306 | 1306 | while (run_start != nb_args) { |
| 1307 | 1307 | int run_gen_reg = gen_reg, run_sse_reg = sse_reg; |
| 1308 | − | |
| 1308 | + | |
| 1309 | 1309 | run_end = nb_args; |
| 1310 | 1310 | stack_adjust = 0; |
| 1311 | 1311 | for(i = run_start; (i < nb_args) && (run_end == nb_args); i++) { |
| @@ -1319,10 +1319,10 @@ void gfunc_call(int nb_args) · 7 unmodified lines | ||
| 1319 | 1319 | stack_adjust += size; |
| 1320 | 1320 | } |
| 1321 | 1321 | } |
| 1322 | − | |
| 1322 | + | |
| 1323 | 1323 | gen_reg = run_gen_reg; |
| 1324 | 1324 | sse_reg = run_sse_reg; |
| 1325 | − | |
| 1325 | + | |
| 1326 | 1326 | /* adjust stack to align SSE boundary */ |
| 1327 | 1327 | if (stack_adjust &= 15) { |
| 1328 | 1328 | /* fetch cpu flag before the following sub will change the value */ |
| @@ -1334,7 +1334,7 @@ void gfunc_call(int nb_args) · 5 unmodified lines | ||
| 1334 | 1334 | oad(0xec81, stack_adjust); /* sub $xxx, %rsp */ |
| 1335 | 1335 | args_size += stack_adjust; |
| 1336 | 1336 | } |
| 1337 | − | |
| 1337 | + | |
| 1338 | 1338 | for(i = run_start; i < run_end;) { |
| 1339 | 1339 | int arg_stored = regargs_nregs(®_args[i]) == 0; |
| 1340 | 1340 | SValue tmp; |
| @@ -1344,7 +1344,7 @@ void gfunc_call(int nb_args) · 3 unmodified lines | ||
| 1344 | 1344 | ++i; |
| 1345 | 1345 | continue; |
| 1346 | 1346 | } |
| 1347 | − | |
| 1347 | + | |
| 1348 | 1348 | /* Swap argument to top, it will possibly be changed here, |
| 1349 | 1349 | and might use more temps. At the end of the loop we keep |
| 1350 | 1350 | in on the stack and swap it back to its original position |
| @@ -1352,7 +1352,7 @@ void gfunc_call(int nb_args) · 1 unmodified line | ||
| 1352 | 1352 | tmp = vtop[0]; |
| 1353 | 1353 | vtop[0] = vtop[-i]; |
| 1354 | 1354 | vtop[-i] = tmp; |
| 1355 | − | |
| 1355 | + | |
| 1356 | 1356 | classify_x86_64_arg(&vtop->type, NULL, &size, &align, &args); |
| 1357 | 1357 | |
| 1358 | 1358 | switch (vtop->type.t & VT_BTYPE) { |
| @@ -1369,11 +1369,11 @@ void gfunc_call(int nb_args) · 10 unmodified lines | ||
| 1369 | 1369 | vstore(); |
| 1370 | 1370 | args_size += size; |
| 1371 | 1371 | break; |
| 1372 | − | |
| 1372 | + | |
| 1373 | 1373 | case VT_LDOUBLE: |
| 1374 | 1374 | assert(0); |
| 1375 | 1375 | break; |
| 1376 | − | |
| 1376 | + | |
| 1377 | 1377 | case VT_FLOAT: |
| 1378 | 1378 | case VT_DOUBLE: |
| 1379 | 1379 | r = gv(RC_FLOAT); |
| @@ -1384,7 +1384,7 @@ void gfunc_call(int nb_args) · 4 unmodified lines | ||
| 1384 | 1384 | o(0x24); |
| 1385 | 1385 | args_size += size; |
| 1386 | 1386 | break; |
| 1387 | − | |
| 1387 | + | |
| 1388 | 1388 | default: |
| 1389 | 1389 | /* simple type */ |
| 1390 | 1390 | /* XXX: implicit cast ? */ |
| @@ -1417,7 +1417,7 @@ void gfunc_call(int nb_args) · 26 unmodified lines | ||
| 1417 | 1417 | break; |
| 1418 | 1418 | |
| 1419 | 1419 | vrotb(i+1); |
| 1420 | − | |
| 1420 | + | |
| 1421 | 1421 | if ((vtop->type.t & VT_BTYPE) == VT_LDOUBLE) { |
| 1422 | 1422 | gv(RC_ST0); |
| 1423 | 1423 | oad(0xec8148, size); /* sub $xxx, %rsp */ |
| @@ -1440,7 +1440,7 @@ void gfunc_call(int nb_args) · 16 unmodified lines | ||
| 1440 | 1440 | vstore(); |
| 1441 | 1441 | args_size += size; |
| 1442 | 1442 | } |
| 1443 | − | |
| 1443 | + | |
| 1444 | 1444 | vpop(); |
| 1445 | 1445 | memmove(reg_args + i, reg_args + i + 1, (nb_args - i - 1) * sizeof *reg_args); |
| 1446 | 1446 | --nb_args; |
| @@ -1698,7 +1698,7 @@ void gfunc_prolog(CType *func_type) · 251 unmodified lines | ||
| 1698 | 1698 | addr += size; |
| 1699 | 1699 | } |
| 1700 | 1700 | break; |
| 1701 | − | |
| 1701 | + | |
| 1702 | 1702 | case x86_64_mode_memory: |
| 1703 | 1703 | case x86_64_mode_x87: |
| 1704 | 1704 | addr = (addr + align - 1) & -align; |
| @@ -2104,7 +2104,7 @@ void gen_opf(int op) · 399 unmodified lines | ||
| 2104 | 2104 | vswap(); |
| 2105 | 2105 | } |
| 2106 | 2106 | assert(!(vtop[-1].r & VT_LVAL)); |
| 2107 | − | |
| 2107 | + | |
| 2108 | 2108 | if ((vtop->type.t & VT_BTYPE) == VT_DOUBLE) |
| 2109 | 2109 | o(0x66); |
| 2110 | 2110 | if (op == TOK_EQ || op == TOK_NE) |
| @@ -2141,7 +2141,7 @@ void gen_opf(int op) · 30 unmodified lines | ||
| 2141 | 2141 | ft = vtop->type.t; |
| 2142 | 2142 | fc = vtop->c.ul; |
| 2143 | 2143 | assert((ft & VT_BTYPE) != VT_LDOUBLE); |
| 2144 | − | |
| 2144 | + | |
| 2145 | 2145 | r = vtop->r; |
| 2146 | 2146 | /* if saved lvalue, then we must reload it */ |
| 2147 | 2147 | if ((vtop->r & VT_VALMASK) == VT_LLOCAL) { |
| @@ -2153,14 +2153,14 @@ void gen_opf(int op) · 5 unmodified lines | ||
| 2153 | 2153 | load(r, &v1); |
| 2154 | 2154 | fc = 0; |
| 2155 | 2155 | } |
| 2156 | − | |
| 2156 | + | |
| 2157 | 2157 | assert(!(vtop[-1].r & VT_LVAL)); |
| 2158 | 2158 | if (swapped) { |
| 2159 | 2159 | assert(vtop->r & VT_LVAL); |
| 2160 | 2160 | gv(RC_FLOAT); |
| 2161 | 2161 | vswap(); |
| 2162 | 2162 | } |
| 2163 | − | |
| 2163 | + | |
| 2164 | 2164 | if ((ft & VT_BTYPE) == VT_DOUBLE) { |
| 2165 | 2165 | o(0xf2); |
| 2166 | 2166 | } else { |
| @@ -2168,7 +2168,7 @@ void gen_opf(int op) · 1 unmodified line | ||
| 2168 | 2168 | } |
| 2169 | 2169 | o(0x0f); |
| 2170 | 2170 | o(0x58 + a); |
| 2171 | − | |
| 2171 | + | |
| 2172 | 2172 | if (vtop->r & VT_LVAL) { |
| 2173 | 2173 | gen_modrm(vtop[-1].r, r, vtop->sym, fc); |
| 2174 | 2174 | } else { |
| @@ -2231,7 +2231,7 @@ void gen_cvt_ftof(int t) · 56 unmodified lines | ||
| 2231 | 2231 | ft = vtop->type.t; |
| 2232 | 2232 | bt = ft & VT_BTYPE; |
| 2233 | 2233 | tbt = t & VT_BTYPE; |
| 2234 | − | |
| 2234 | + | |
| 2235 | 2235 | if (bt == VT_FLOAT) { |
| 2236 | 2236 | gv(RC_FLOAT); |
| 2237 | 2237 | if (tbt == VT_DOUBLE) { |