fix header parsing bug and unistd.h header; fixes unistd_confstr

This commit is contained in:
Alon Zakai 2011-09-25 18:56:58 -07:00
Родитель 39b93880df
Коммит 80e2f0333d
3 изменённых файлов: 10 добавлений и 7 удалений

Просмотреть файл

@ -169,23 +169,25 @@ def main(args):
defines = {}
include_root = path_from_root('system', 'include')
headers = args.headers[0].split(',') if len(args.headers) > 0 else []
seen_headers = set()
while len(headers) > 0:
header = headers.pop(0)
if not os.path.isabs(header):
header = os.path.join(include_root, header)
seen_headers.add(header)
for line in open(header, 'r'):
line = line.replace('\t', ' ')
m = re.match('^ *#define +(?P<name>[-\w_.]+) +\(?(?P<value>[-\w_.|]+)\)?.*', line)
m = re.match('^ *# *define +(?P<name>[-\w_.]+) +\(?(?P<value>[-\w_.|]+)\)?.*', line)
if m:
defines[m.group('name')] = m.group('value')
m = re.match('^ *#include *["<](?P<name>[\w_.-/]+)[">].*', line)
m = re.match('^ *# *include *["<](?P<name>[\w_.-/]+)[">].*', line)
if m:
# Find this file
found = False
for w in [w for w in os.walk(include_root)]:
for f in w[2]:
curr = os.path.join(w[0], f)
if curr.endswith(m.group('name')):
if curr.endswith(m.group('name')) and curr not in seen_headers:
headers.append(curr)
found = True
break

Просмотреть файл

@ -490,11 +490,11 @@ int _EXFUN(unlinkat, (int, const char *, int));
#define _CS_POSIX_V7_THREADS_CFLAGS 18
#define _CS_POSIX_V7_THREADS_LDFLAGS 19
#define _CS_V7_ENV 20
#define _CS_V6_ENV _CS_V6_ENV
/* XXX Emscripten: two additional ones */
#define _CS_GNU_LIBC_VERSION 42
#define _CS_GNU_LIBPTHREAD_VERSION 42
/* XXX Emscripten: remove self-ref, and add two additional ones */
/* #define _CS_V6_ENV _CS_V6_ENV */
#define _CS_GNU_LIBC_VERSION 42
#define _CS_GNU_LIBPTHREAD_VERSION 43
#endif

Просмотреть файл

@ -189,6 +189,7 @@ class RunnerCore(unittest.TestCase):
except OSError:
os.chdir(self.get_dir()) # ensure the current working directory is valid
compiler_output = timeout_run(Popen([EMSCRIPTEN, filename + ('.o.ll' if append_ext else ''), '-o', filename + '.o.js'] + settings + extra_args, stdout=PIPE, stderr=STDOUT), TIMEOUT, 'Compiling')
#print compiler_output
# Detect compilation crashes and errors
if compiler_output is not None and 'Traceback' in compiler_output and 'in test_' in compiler_output: print compiler_output; assert 0