History

tccasm: define __ASSEMBLER__ for .S files, like gcc does

Joe Soroka committed 15 years ago

Commit a25325e1 parent 75c66952 files · +10 −0Browse files

Unified · Split

2 files
  1. libtcc.c +6 −0
  2. tests/asmtest.S +4 −0
libtcc.c+6−0
@@ -1080,6 +1080,12 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags) · 1079 unmodified lines
10801080 if (ext[0])
10811081 ext++;
10821082
1083+#ifdef CONFIG_TCC_ASM
1084+ /* if .S file, define __ASSEMBLER__ like gcc does */
1085+ if (!strcmp(ext, "S"))
1086+ tcc_define_symbol(s1, "__ASSEMBLER__", NULL);
1087+#endif
1088+
10831089 /* open the file */
10841090 ret = tcc_open(s1, filename);
10851091 if (ret < 0) {
tests/asmtest.S+4−0
@@ -564,3 +564,7 @@ int $0x10 · 563 unmodified lines
564564 pushl $1
565565 pushw $1
566566 push $1
567+
568+#ifdef __ASSEMBLER__ // should be defined, for S files
569+ inc %eax
570+#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t