+commit 331735a357a73c7b8adc205241ac3cc6543d985e
+Author: Felix Fietkau <nbd@openwrt.org>
+Date: Tue Nov 17 12:38:22 2015 +0000
+
+ gcc: add a patch to 5.x that supports translation of __FILE__ paths
+
+ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+ SVN-Revision: 47490
+
Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47047
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
-@@ -581,6 +581,10 @@ c_common_handle_option (size_t scode, co
+@@ -588,6 +588,10 @@ c_common_handle_option (size_t scode, co
add_path (xstrdup (arg), SYSTEM, 0, true);
break;
break;
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
-@@ -1528,6 +1528,10 @@ iquote
+@@ -1825,6 +1825,10 @@ iquote
C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs)
- -iquote <dir> Add <dir> to the end of the quote include path
+ -iquote <dir> Add <dir> to the end of the quote include path.
+iremap
+C ObjC C++ ObjC++ Joined Separate
+
iwithprefix
C ObjC C++ ObjC++ Joined Separate
- -iwithprefix <dir> Add <dir> to the end of the system include path
+ -iwithprefix <dir> Add <dir> to the end of the system include path.
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
-@@ -4441,6 +4441,7 @@ without notice.
+@@ -4272,6 +4272,7 @@ Refer to the GCC manual for full documen
@c man begin SYNOPSIS
cpp [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
[@option{-I}@var{dir}@dots{}] [@option{-iquote}@var{dir}@dots{}]
+ [@option{-iremap}@var{src}:@var{dst}]
- [@option{-W}@var{warn}@dots{}]
[@option{-M}|@option{-MM}] [@option{-MG}] [@option{-MF} @var{filename}]
[@option{-MP}] [@option{-MQ} @var{target}@dots{}]
+ [@option{-MT} @var{target}@dots{}]
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
-@@ -532,6 +532,12 @@ Search @var{dir} only for header files r
- If @var{dir} begins with @code{=}, then the @code{=} will be replaced
- by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
+@@ -220,6 +220,12 @@ extensions @samp{.i}, @samp{.ii} or @sam
+ extensions that GCC uses for preprocessed files created by
+ @option{-save-temps}.
+@item -iremap @var{src}:@var{dst}
+@opindex iremap
When preprocessing, handle directives, but do not expand macros.
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
-@@ -494,8 +494,8 @@ Objective-C and Objective-C++ Dialects}.
- @item Directory Options
- @xref{Directory Options,,Options for Directory Search}.
- @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
---iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol
----sysroot=@var{dir} --no-sysroot-suffix}
-+-iquote@var{dir} -iremap@var{src}:@var{dst} -L@var{dir} -specs=@var{file} @gol
-+-I- --sysroot=@var{dir} --no-sysroot-suffix}
-
- @item Machine Dependent Options
- @xref{Submodel Options,,Hardware Models and Configurations}.
-@@ -11479,6 +11479,12 @@ be searched for header files only for th
- "@var{file}"}; they are not searched for @code{#include <@var{file}>},
- otherwise just like @option{-I}.
+@@ -11871,6 +11871,12 @@ by @option{-fplugin=@var{name}} instead
+ @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
+ to be used by the user, but only passed by the driver.
+@item -iremap @var{src}:@var{dst}
+@opindex iremap
Add directory @var{dir} to the list of directories to be searched
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
-@@ -751,6 +751,9 @@ extern void cpp_set_lang (cpp_reader *,
+@@ -820,6 +820,9 @@ extern void cpp_set_lang (cpp_reader *,
/* Set the include paths. */
extern void cpp_set_include_chains (cpp_reader *, cpp_dir *, cpp_dir *, int);
call cpp_finish on that reader. You can either edit the callbacks
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
-@@ -224,6 +224,64 @@ static const char * const monthnames[] =
+@@ -227,6 +227,64 @@ static const char * const monthnames[] =
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
/* Helper function for builtin_macro. Returns the text generated by
a builtin macro. */
const uchar *
-@@ -286,6 +344,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
+@@ -290,6 +348,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
{
unsigned int len;
const char *name;
uchar *buf;
if (node->value.builtin == BT_FILE)
-@@ -297,6 +356,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
+@@ -301,6 +360,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
if (!name)
abort ();
}
len = strlen (name);
buf = _cpp_unaligned_alloc (pfile, len * 2 + 3);
result = buf;
-@@ -304,6 +364,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
+@@ -308,6 +368,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
buf = cpp_quote_string (buf + 1, (const unsigned char *) name, len);
*buf++ = '"';
*buf = '\0';