History

Revert "-fnormalize-inc-dirs"

Too much code. gcc 3.x doesn't have that either. This reverts commit 41785a0bf9d505a3647a10ddc330417f52fd4528. This reverts commit 21665f433890e2038626f0b3123b189a62a67dc9.

grischka committed 10 years ago

Commit c5b9ae41 parent 643a1b84 files · +1 −100Browse files

Unified · Split

4 files
  1. libtcc.c +0 −93
  2. tcc-doc.texi +1 −5
  3. tcc.h +0 −1
  4. tccpp.c +0 −1
libtcc.c+0−93
@@ -1500,96 +1500,6 @@ LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, const void *val) · 1499 unmodified lines
15001500 return 0;
15011501 }
15021502
1503−
1504−/* Windows stat* ( https://msdn.microsoft.com/en-us/library/14h5k7ff.aspx ):
1505− * - st_gid, st_ino, st_uid: only valid on "unix" file systems (not FAT, NTFS, etc)
1506− * - st_atime, st_ctime: not valid on FAT, valid on NTFS.
1507− * - Other fields should be reasonably compatible (and S_ISDIR should work).
1508− *
1509− * BY_HANDLE_FILE_INFORMATION ( https://msdn.microsoft.com/en-us/library/windows/desktop/aa363788%28v=vs.85%29.aspx ):
1510− * - File index (combined nFileIndexHigh and nFileIndexLow) _may_ change when the file is opened.
1511− * - But on NTFS: it's guaranteed to be the same value until the file is deleted.
1512− * - On windows server 2012 there's a 128b file id, and the 64b one via
1513− * nFileIndex* is not guaranteed to be unique.
1514− *
1515− * - MS Docs suggest to that volume number with the file index could be used to
1516− * check if two handles refer to the same file.
1517− */
1518−#ifndef _WIN32
1519−typedef struct stat file_info_t;
1520−#else
1521−typedef BY_HANDLE_FILE_INFORMATION file_info_t;
1522−#endif
1523−
1524−static int get_file_info(const char *fname, file_info_t *out_info)
1525−{
1526−#ifndef _WIN32
1527− return stat(fname, out_info);
1528−#else
1529− int rv = 1;
1530− HANDLE h = CreateFile(fname, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
1531− FILE_ATTRIBUTE_NORMAL|FILE_FLAG_BACKUP_SEMANTICS, NULL);
1532−
1533− if (h != INVALID_HANDLE_VALUE) {
1534− rv = !GetFileInformationByHandle(h, out_info);
1535− CloseHandle(h);
1536− }
1537− return rv;
1538−#endif
1539−}
1540−
1541−static int is_dir(file_info_t *info)
1542−{
1543−#ifndef _WIN32
1544− return S_ISDIR(info->st_mode);
1545−#else
1546− return (info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ==
1547− FILE_ATTRIBUTE_DIRECTORY;
1548−#endif
1549−}
1550−
1551−static int is_same_file(const file_info_t *fi1, const file_info_t *fi2)
1552−{
1553−#ifndef _WIN32
1554− return fi1->st_dev == fi2->st_dev &&
1555− fi1->st_ino == fi2->st_ino;
1556−#else
1557− return fi1->dwVolumeSerialNumber == fi2->dwVolumeSerialNumber &&
1558− fi1->nFileIndexHigh == fi2->nFileIndexHigh &&
1559− fi1->nFileIndexLow == fi2->nFileIndexLow;
1560−#endif
1561−}
1562−
1563−static void
1564−tcc_normalize_inc_dirs_aux(file_info_t *stats, size_t *pnum, char **path)
1565−{
1566− size_t i, num = *pnum;
1567− if (get_file_info(*path, &stats[num]) || !is_dir(&stats[num]))
1568− goto remove;
1569− for (i = 0; i < num; i++)
1570− if (is_same_file(&stats[i], &stats[num]))
1571− goto remove;
1572− *pnum = num + 1;
1573− return;
1574− remove:
1575− tcc_free(*path);
1576− *path = 0;
1577−}
1578−
1579−/* Remove non-existent and duplicate directories from include paths. */
1580−ST_FUNC void tcc_normalize_inc_dirs(TCCState *s)
1581−{
1582− file_info_t *stats =
1583− tcc_malloc(((size_t)s->nb_sysinclude_paths + s->nb_include_paths) *
1584− sizeof(*stats));
1585− size_t i, num = 0;
1586− for (i = 0; i < s->nb_sysinclude_paths; i++)
1587− tcc_normalize_inc_dirs_aux(stats, &num, &s->sysinclude_paths[i]);
1588− for (i = 0; i < s->nb_include_paths; i++)
1589− tcc_normalize_inc_dirs_aux(stats, &num, &s->include_paths[i]);
1590− tcc_free(stats);
1591−}
1592−
15931503 LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type)
15941504 {
15951505 s->output_type = output_type;
@@ -1643,8 +1553,6 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) · 47 unmodified lines
16431553 tcc_add_crt(s, "crti.o");
16441554 }
16451555 #endif
1646− if (s->normalize_inc_dirs)
1647− tcc_normalize_inc_dirs(s);
16481556 return 0;
16491557 }
16501558
@@ -1729,7 +1637,6 @@ static const FlagDef flag_defs[] = { · 78 unmodified lines
17291637 { offsetof(TCCState, ms_extensions), 0, "ms-extensions" },
17301638 { offsetof(TCCState, old_struct_init_code), 0, "old-struct-init-code" },
17311639 { offsetof(TCCState, dollars_in_identifiers), 0, "dollars-in-identifiers" },
1732− { offsetof(TCCState, normalize_inc_dirs), 0, "normalize-inc-dirs" },
17331640 };
17341641
17351642 /* set/reset a flag */
tcc-doc.texi+1−5
@@ -242,11 +242,7 @@ assume a nested named structure declaration without identifier behave · 241 unmodified lines
242242 like an unnamed one.
243243
244244 @item -fdollars-in-identifiers
245−Allow a dollars in identifiers.
246−
247−@item -fnormalize-inc-dirs
248−Be more gcc compatible and remove non-existent or duplicate directories
249−from include paths. This helps to compile such packages as coreutils.
245+Allow a dollars in identifiers
250246
251247 @end table
252248
tcc.h+0−1
@@ -616,7 +616,6 @@ struct TCCState { · 615 unmodified lines
616616 int old_struct_init_code; /* use old algorithm to init array in struct when there is no '{' used.
617617 Liuux 2.4.26 can't find initrd when compiled with a new algorithm */
618618 int dollars_in_identifiers; /* allows '$' char in indentifiers */
619− int normalize_inc_dirs; /* remove non-existent or duplicate directories from include paths */
620619
621620 /* warning switches */
622621 int warn_write_strings;
tccpp.c+0−1
@@ -1783,7 +1783,6 @@ ST_FUNC void preprocess(int is_bof) · 1782 unmodified lines
17831783 /* search in all the include paths */
17841784 int j = i - 2, k = j - s1->nb_include_paths;
17851785 path = k < 0 ? s1->include_paths[j] : s1->sysinclude_paths[k];
1786− if (path == 0) continue;
17871786 pstrcpy(buf1, sizeof(buf1), path);
17881787 pstrcat(buf1, sizeof(buf1), "/");
17891788 }

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