| 173 | } |
| 174 | |
| 175 | static enum compiler_e get_compiler(char *ccname) |
| 176 | { |
| 177 | /* Let's assume that all GCC compiler paths contain the string gcc or |
| 178 | * g++ and no non-GCC compiler paths include these substrings. |
| 179 | * |
| 180 | * If the compiler is called cc, let's assume that is GCC too. |
| 181 | */ |
| 182 | |
| 183 | if (strstr(ccname, "gcc") != NULL || |
| 184 | strstr(ccname, "g++") != NULL || |
| 185 | strncmp(ccname, "cc.", 3) == 0) |
| 186 | { |
| 187 | return COMPILER_GCC; |
| 188 | } |
| 189 | else if (strstr(ccname, "clang") != NULL) |
| 190 | { |
| 191 | return COMPILER_CLANG; |
| 192 | } |
| 193 | else if (strstr(ccname, "sdcc") != NULL) |
| 194 | { |
| 195 | return COMPILER_SDCC; |
| 196 | } |
| 197 | else if (strstr(ccname, "ccarm") != NULL || |
| 198 | strstr(ccname, "cxarm") != NULL) |
| 199 | { |
| 200 | return COMPILER_GHS; |
| 201 | } |
| 202 | else if (strstr(ccname, "mingw") != NULL) |
| 203 | { |
| 204 | return COMPILER_MINGW; |
| 205 | } |
| 206 | else if (strstr(ccname, "ez8cc") != NULL || |
| 207 | strstr(ccname, "zneocc") != NULL || |
| 208 | strstr(ccname, "ez80cc") != NULL) |
| 209 | { |
| 210 | return COMPILER_ZDSII; |
| 211 | } |
| 212 | else if (strstr(ccname, "ctc") != NULL) |
| 213 | { |
| 214 | return COMPILER_TASKING; |
| 215 | } |
| 216 | else |
| 217 | { |
| 218 | /* Unknown compiler. Assume GCC-compatible */ |
| 219 | |
| 220 | return COMPILER_GCC; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | static int my_asprintf(char **strp, const char *fmt, ...) |
| 225 | { |