History

default output object filename is basename of input filename (same behaviour as gcc)

bellard committed 23 years ago

Commit 410fc571 parent 066d5e71 file · +19 −1Browse files

Unified · Split

tcc.c+19−1
@@ -9323,6 +9323,22 @@ int tcc_set_output_type(TCCState *s, int output_type) · 9322 unmodified lines
9323 9323
9324#if !defined(LIBTCC)9324#if !defined(LIBTCC)
9325 9325
9326/* extract the basename of a file */
9327static const char *tcc_basename(const char *name)
9328{
9329 const char *p;
9330 p = strrchr(name, '/');
9331#ifdef WIN32
9332 if (!p)
9333 p = strrchr(name, '\\');
9334#endif
9335 if (!p)
9336 p = name;
9337 else
9338 p++;
9339 return p;
9340}
9341
9326static int64_t getclock_us(void)9342static int64_t getclock_us(void)
9327{9343{
9328#ifdef WIN329344#ifdef WIN32
@@ -9625,8 +9641,10 @@ int main(int argc, char **argv) · 296 unmodified lines
9625 if (output_type != TCC_OUTPUT_MEMORY && !outfile) {9641 if (output_type != TCC_OUTPUT_MEMORY && !outfile) {
9626 if (output_type == TCC_OUTPUT_OBJ && !reloc_output) {9642 if (output_type == TCC_OUTPUT_OBJ && !reloc_output) {
9627 char *ext;9643 char *ext;
9644 /* strip path */
9645 pstrcpy(objfilename, sizeof(objfilename) - 1,
9646 tcc_basename(files[0]));
9628 /* add .o extension */9647 /* add .o extension */
9629 pstrcpy(objfilename, sizeof(objfilename) - 1, files[0]);
9630 ext = strrchr(objfilename, '.');9648 ext = strrchr(objfilename, '.');
9631 if (!ext)9649 if (!ext)
9632 goto default_outfile;9650 goto default_outfile;

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