aboutsummaryrefslogtreecommitdiff
path: root/tcc.c
diff options
context:
space:
mode:
authorgrischka <grischka>2016-10-01 20:04:58 +0200
committergrischka <grischka>2016-10-01 20:04:58 +0200
commit09a487eb2b2bcabeaeec8d2c7ca422993df0efb5 (patch)
treeb164eb23745cf39999d7d3e2bf1691a05931977f /tcc.c
parente63011377173062d688a08e8a98abbdada453302 (diff)
downloadtinycc-09a487eb2b2bcabeaeec8d2c7ca422993df0efb5.tar.gz
tinycc-09a487eb2b2bcabeaeec8d2c7ca422993df0efb5.tar.bz2
libtcc: cleanup -x<filetype> switch code
Abusing filename[0] as type is just too much of a hack. -- From 05364072042ff37904a7b0b14cdd85a1ea1ca11d
Diffstat (limited to 'tcc.c')
-rw-r--r--tcc.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/tcc.c b/tcc.c
index cf08614..0132a2e 100644
--- a/tcc.c
+++ b/tcc.c
@@ -307,23 +307,17 @@ int main(int argc, char **argv)
/* compile or add each files or library */
for(i = ret = 0; i < s->nb_files && ret == 0; i++) {
- int filetype = *(unsigned char *)s->files[i];
- const char *filename = s->files[i] + 1;
- if (filename[0] == '-' && filename[1] == 'l') {
- if (tcc_add_library(s, filename + 2) < 0) {
- /* don't fail on -lm as it's harmless to skip math lib */
- if (strcmp(filename + 2, "m")) {
- tcc_error_noabort("cannot find library 'lib%s'", filename + 2);
- ret = 1;
- }
- }
+ struct filespec *f = s->files[i];
+ if (f->type == 'l') {
+ if (tcc_add_library_err(s, f->name) < 0)
+ ret = 1;
} else {
if (1 == s->verbose)
- printf("-> %s\n", filename);
- if (tcc_add_file(s, filename, filetype) < 0)
+ printf("-> %s\n", f->name);
+ if (tcc_add_file(s, f->name, f->type) < 0)
ret = 1;
if (!first_file)
- first_file = filename;
+ first_file = f->name;
}
}