Module Name: src
Committed By: mrg
Date: Tue Oct 1 21:17:28 UTC 2019
Modified Files:
src/external/gpl3/gcc/dist/gcc: Makefile.in file-prefix-map.c final.c
src/external/gpl3/gcc/dist/gcc/c-family: c-opts.c
Log Message:
merge debug/file prefix/merge stuff with upstream, which has gained
a lot of the same features. builds, but may not actually run right.
adjust for add_path()'s SYSTEM -> INC_SYSTEM.
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/external/gpl3/gcc/dist/gcc/Makefile.in
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gcc/dist/gcc/file-prefix-map.c
cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gcc/dist/gcc/final.c
cvs rdiff -u -r1.8 -r1.9 src/external/gpl3/gcc/dist/gcc/c-family/c-opts.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/gpl3/gcc/dist/gcc/Makefile.in
diff -u src/external/gpl3/gcc/dist/gcc/Makefile.in:1.18 src/external/gpl3/gcc/dist/gcc/Makefile.in:1.19
--- src/external/gpl3/gcc/dist/gcc/Makefile.in:1.18 Tue Oct 1 10:38:16 2019
+++ src/external/gpl3/gcc/dist/gcc/Makefile.in Tue Oct 1 21:17:27 2019
@@ -1955,6 +1955,7 @@ CPP_SELFTEST_DEPS = cc1plus$(exeext) $(S
selftest: s-selftest-c
# C selftests
+C_SELFTEST_DEPS =
s-selftest-c: $(C_SELFTEST_DEPS)
@echo "NOT REBUILDING $@"
NetBSD_DISABLED_s-selftest:
Index: src/external/gpl3/gcc/dist/gcc/file-prefix-map.c
diff -u src/external/gpl3/gcc/dist/gcc/file-prefix-map.c:1.1.1.1 src/external/gpl3/gcc/dist/gcc/file-prefix-map.c:1.2
--- src/external/gpl3/gcc/dist/gcc/file-prefix-map.c:1.1.1.1 Tue Oct 1 09:36:24 2019
+++ src/external/gpl3/gcc/dist/gcc/file-prefix-map.c Tue Oct 1 21:17:28 2019
@@ -123,6 +123,7 @@ remap_macro_filename (const char *filena
return remap_filename (macro_prefix_maps, filename);
}
+#ifndef __NetBSD__
/* Remap using -fdebug-prefix-map. Return the GC-allocated new name
corresponding to FILENAME or FILENAME if no remapping was performed. */
const char *
@@ -130,3 +131,111 @@ remap_debug_filename (const char *filena
{
return remap_filename (debug_prefix_maps, filename);
}
+#else
+
+/* Perform user-specified mapping of debug filename prefixes. Return
+ the new name corresponding to FILENAME. */
+
+static const char *
+remap_debug_prefix_filename (const char *filename)
+{
+ file_prefix_map *map;
+ char *s;
+ const char *name;
+ size_t name_len;
+
+ for (map = debug_prefix_maps; map; map = map->next)
+ if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
+ break;
+ if (!map)
+ return filename;
+ name = filename + map->old_len;
+ name_len = strlen (name) + 1;
+ s = (char *) alloca (name_len + map->new_len);
+ memcpy (s, map->new_prefix, map->new_len);
+ memcpy (s + map->new_len, name, name_len);
+ return ggc_strdup (s);
+}
+
+#include <regex.h>
+
+typedef struct debug_regex_map
+{
+ regex_t re;
+ const char *sub;
+ struct debug_regex_map *next;
+} debug_regex_map;
+
+/* Linked list of such structures. */
+debug_regex_map *debug_regex_maps;
+
+
+/* Record a debug file regex mapping. ARG is the argument to
+ -fdebug-regex-map and must be of the form OLD=NEW. */
+
+void
+add_debug_regex_map (const char *arg)
+{
+ debug_regex_map *map;
+ const char *p;
+ char *old;
+ char buf[1024];
+ regex_t re;
+ int e;
+
+ p = strchr (arg, '=');
+ if (!p)
+ {
+ error ("invalid argument %qs to -fdebug-regex-map", arg);
+ return;
+ }
+
+ old = xstrndup (arg, p - arg);
+ if ((e = regcomp(&re, old, REG_EXTENDED)) != 0)
+ {
+ regerror(e, &re, buf, sizeof(buf));
+ warning (0, "regular expression compilation for %qs in argument to "
+ "-fdebug-regex-map failed: %qs", old, buf);
+ free(old);
+ return;
+ }
+ free(old);
+
+ map = XNEW (debug_regex_map);
+ map->re = re;
+ p++;
+ map->sub = xstrdup (p);
+ map->next = debug_regex_maps;
+ debug_regex_maps = map;
+}
+
+extern "C" ssize_t regasub(char **, const char *,
+ const regmatch_t *rm, const char *);
+
+/* Perform user-specified mapping of debug filename regular expressions. Return
+ the new name corresponding to FILENAME. */
+
+static const char *
+remap_debug_regex_filename (const char *filename)
+{
+ debug_regex_map *map;
+ char *s;
+ regmatch_t rm[10];
+
+ for (map = debug_regex_maps; map; map = map->next)
+ if (regexec (&map->re, filename, 10, rm, 0) == 0
+ && regasub (&s, map->sub, rm, filename) >= 0)
+ {
+ const char *name = ggc_strdup(s);
+ free(s);
+ return name;
+ }
+ return filename;
+}
+
+const char *
+remap_debug_filename (const char *filename)
+{
+ return remap_debug_regex_filename (remap_debug_prefix_filename (filename));
+}
+#endif
Index: src/external/gpl3/gcc/dist/gcc/final.c
diff -u src/external/gpl3/gcc/dist/gcc/final.c:1.10 src/external/gpl3/gcc/dist/gcc/final.c:1.11
--- src/external/gpl3/gcc/dist/gcc/final.c:1.10 Tue Oct 1 10:38:16 2019
+++ src/external/gpl3/gcc/dist/gcc/final.c Tue Oct 1 21:17:28 2019
@@ -1508,177 +1508,6 @@ asm_str_count (const char *templ)
return count;
}
-/* ??? This is probably the wrong place for these. */
-/* Structure recording the mapping from source file and directory
- names at compile time to those to be embedded in debug
- information. */
-struct debug_prefix_map
-{
- const char *old_prefix;
- const char *new_prefix;
- size_t old_len;
- size_t new_len;
- struct debug_prefix_map *next;
-};
-
-/* Linked list of such structures. */
-static debug_prefix_map *debug_prefix_maps;
-
-
-/* Record a debug file prefix mapping. ARG is the argument to
- -fdebug-prefix-map and must be of the form OLD=NEW. */
-
-void
-add_debug_prefix_map (const char *arg)
-{
- debug_prefix_map *map;
- const char *p;
- char *env;
- const char *old;
- size_t oldlen;
-
- p = strchr (arg, '=');
- if (!p)
- {
- error ("invalid argument %qs to -fdebug-prefix-map", arg);
- return;
- }
- if (*arg == '$')
- {
- env = xstrndup (arg+1, p - (arg+1));
- old = getenv(env);
- if (!old)
- {
- warning (0, "environment variable %qs not set in argument to "
- "-fdebug-prefix-map", env);
- free(env);
- return;
- }
- oldlen = strlen(old);
- free(env);
- }
- else
- {
- old = xstrndup (arg, p - arg);
- oldlen = p - arg;
- }
-
- map = XNEW (debug_prefix_map);
- map->old_prefix = old;
- map->old_len = oldlen;
- p++;
- map->new_prefix = xstrdup (p);
- map->new_len = strlen (p);
- map->next = debug_prefix_maps;
- debug_prefix_maps = map;
-}
-
-/* Perform user-specified mapping of debug filename prefixes. Return
- the new name corresponding to FILENAME. */
-
-static const char *
-remap_debug_prefix_filename (const char *filename)
-{
- debug_prefix_map *map;
- char *s;
- const char *name;
- size_t name_len;
-
- for (map = debug_prefix_maps; map; map = map->next)
- if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
- break;
- if (!map)
- return filename;
- name = filename + map->old_len;
- name_len = strlen (name) + 1;
- s = (char *) alloca (name_len + map->new_len);
- memcpy (s, map->new_prefix, map->new_len);
- memcpy (s + map->new_len, name, name_len);
- return ggc_strdup (s);
-}
-
-#include <regex.h>
-
-typedef struct debug_regex_map
-{
- regex_t re;
- const char *sub;
- struct debug_regex_map *next;
-} debug_regex_map;
-
-/* Linked list of such structures. */
-debug_regex_map *debug_regex_maps;
-
-
-/* Record a debug file regex mapping. ARG is the argument to
- -fdebug-regex-map and must be of the form OLD=NEW. */
-
-void
-add_debug_regex_map (const char *arg)
-{
- debug_regex_map *map;
- const char *p;
- char *old;
- char buf[1024];
- regex_t re;
- int e;
-
- p = strchr (arg, '=');
- if (!p)
- {
- error ("invalid argument %qs to -fdebug-regex-map", arg);
- return;
- }
-
- old = xstrndup (arg, p - arg);
- if ((e = regcomp(&re, old, REG_EXTENDED)) != 0)
- {
- regerror(e, &re, buf, sizeof(buf));
- warning (0, "regular expression compilation for %qs in argument to "
- "-fdebug-regex-map failed: %qs", old, buf);
- free(old);
- return;
- }
- free(old);
-
- map = XNEW (debug_regex_map);
- map->re = re;
- p++;
- map->sub = xstrdup (p);
- map->next = debug_regex_maps;
- debug_regex_maps = map;
-}
-
-extern "C" ssize_t regasub(char **, const char *,
- const regmatch_t *rm, const char *);
-
-/* Perform user-specified mapping of debug filename regular expressions. Return
- the new name corresponding to FILENAME. */
-
-static const char *
-remap_debug_regex_filename (const char *filename)
-{
- debug_regex_map *map;
- char *s;
- regmatch_t rm[10];
-
- for (map = debug_regex_maps; map; map = map->next)
- if (regexec (&map->re, filename, 10, rm, 0) == 0
- && regasub (&s, map->sub, rm, filename) >= 0)
- {
- const char *name = ggc_strdup(s);
- free(s);
- return name;
- }
- return filename;
-}
-
-const char *
-remap_debug_filename (const char *filename)
-{
- return remap_debug_regex_filename (remap_debug_prefix_filename (filename));
-}
-
/* Return true if DWARF2 debug info can be emitted for DECL. */
static bool
Index: src/external/gpl3/gcc/dist/gcc/c-family/c-opts.c
diff -u src/external/gpl3/gcc/dist/gcc/c-family/c-opts.c:1.8 src/external/gpl3/gcc/dist/gcc/c-family/c-opts.c:1.9
--- src/external/gpl3/gcc/dist/gcc/c-family/c-opts.c:1.8 Tue Oct 1 10:38:17 2019
+++ src/external/gpl3/gcc/dist/gcc/c-family/c-opts.c Tue Oct 1 21:17:28 2019
@@ -305,7 +305,7 @@ c_common_handle_option (size_t scode, co
break;
case OPT_cxx_isystem:
- add_path (xstrdup (arg), SYSTEM, 1, true);
+ add_path (xstrdup (arg), INC_SYSTEM, 1, true);
break;
case OPT_D: