[PATCH] cleanup in c-parser

2014-10-12 Thread Anthony Brandon
Hi,

I'm a new contributor and I don't yet have a copyright assignment or
commit access.

This is a cleanup of code duplication in c-parser.
I bootstrapped and tested on x86_64-linux.


gcc/c/ChangeLog:

2014-10-12  Anthony Brandon  

* c-parser.c (c_parser_all_labels): New function to replace
the duplicate code.
(c_parser_statement): Call the new function.
Index: gcc/c/c-parser.c
===
--- gcc/c/c-parser.c(revision 215973)
+++ gcc/c/c-parser.c(working copy)
@@ -4654,6 +4654,16 @@
   mark_valid_location_for_stdc_pragma (save_valid_for_pragma);
 }
 
+static void
+c_parser_all_labels (c_parser *parser)
+{
+  while (c_parser_next_token_is_keyword (parser, RID_CASE)
+|| c_parser_next_token_is_keyword (parser, RID_DEFAULT)
+|| (c_parser_next_token_is (parser, CPP_NAME)
+&& c_parser_peek_2nd_token (parser)->type == CPP_COLON))
+c_parser_label (parser);
+}
+
 /* Parse a label (C90 6.6.1, C99 6.8.1).
 
label:
@@ -4854,11 +4864,7 @@
 static void
 c_parser_statement (c_parser *parser)
 {
-  while (c_parser_next_token_is_keyword (parser, RID_CASE)
-|| c_parser_next_token_is_keyword (parser, RID_DEFAULT)
-|| (c_parser_next_token_is (parser, CPP_NAME)
-&& c_parser_peek_2nd_token (parser)->type == CPP_COLON))
-c_parser_label (parser);
+  c_parser_all_labels (parser);
   c_parser_statement_after_labels (parser);
 }
 
@@ -5090,11 +5096,7 @@
 {
   tree block = c_begin_compound_stmt (flag_isoc99);
   location_t body_loc = c_parser_peek_token (parser)->location;
-  while (c_parser_next_token_is_keyword (parser, RID_CASE)
-|| c_parser_next_token_is_keyword (parser, RID_DEFAULT)
-|| (c_parser_next_token_is (parser, CPP_NAME)
-&& c_parser_peek_2nd_token (parser)->type == CPP_COLON))
-c_parser_label (parser);
+  c_parser_all_labels (parser);
   *if_p = c_parser_next_token_is_keyword (parser, RID_IF);
   if (c_parser_next_token_is (parser, CPP_SEMICOLON))
 {
@@ -5121,11 +5123,7 @@
 {
   location_t else_loc = c_parser_peek_token (parser)->location;
   tree block = c_begin_compound_stmt (flag_isoc99);
-  while (c_parser_next_token_is_keyword (parser, RID_CASE)
-|| c_parser_next_token_is_keyword (parser, RID_DEFAULT)
-|| (c_parser_next_token_is (parser, CPP_NAME)
-&& c_parser_peek_2nd_token (parser)->type == CPP_COLON))
-c_parser_label (parser);
+  c_parser_all_labels (parser);
   if (c_parser_next_token_is (parser, CPP_SEMICOLON))
 {
   location_t loc = c_parser_peek_token (parser)->location;


Re: [PATCH] cleanup in c-parser

2014-10-13 Thread Anthony Brandon
I updated the patch with a comment. Actually, Manuel handed me this
patch just to help me get familiar with the process of submitting and
testing.
Generating this one with git diff looks different so I'm not sure if
that's a problem or not.

Thanks,
Anthony

On Sun, Oct 12, 2014 at 10:09 PM,   wrote:
>
>
>
>
>> On Oct 12, 2014, at 12:37 PM, Anthony Brandon  
>> wrote:
>>
>> Hi,
>>
>> I'm a new contributor and I don't yet have a copyright assignment or
>> commit access.
>
>
> Thanks for you contribution.  Your new function is missing a comment before 
> it saying what it does. Yes it might be obvious what the function does but 
> the coding style requires it.
>
> Thanks,
> Andrew
>
>>
>> This is a cleanup of code duplication in c-parser.
>> I bootstrapped and tested on x86_64-linux.
>>
>>
>> gcc/c/ChangeLog:
>>
>> 2014-10-12  Anthony Brandon  
>>
>>* c-parser.c (c_parser_all_labels): New function to replace
>> the duplicate code.
>>(c_parser_statement): Call the new function.
>> 



-- 
Anthony
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 0d159fd..346448a 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -4654,6 +4654,18 @@ c_parser_compound_statement_nostart (c_parser *parser)
   mark_valid_location_for_stdc_pragma (save_valid_for_pragma);
 }
 
+/* Parse all consecutive labels. */
+
+static void
+c_parser_all_labels (c_parser *parser)
+{
+  while (c_parser_next_token_is_keyword (parser, RID_CASE)
+|| c_parser_next_token_is_keyword (parser, RID_DEFAULT)
+|| (c_parser_next_token_is (parser, CPP_NAME)
+&& c_parser_peek_2nd_token (parser)->type == CPP_COLON))
+c_parser_label (parser);
+}
+
 /* Parse a label (C90 6.6.1, C99 6.8.1).
 
label:
@@ -4854,11 +4866,7 @@ c_parser_label (c_parser *parser)
 static void
 c_parser_statement (c_parser *parser)
 {
-  while (c_parser_next_token_is_keyword (parser, RID_CASE)
-|| c_parser_next_token_is_keyword (parser, RID_DEFAULT)
-|| (c_parser_next_token_is (parser, CPP_NAME)
-&& c_parser_peek_2nd_token (parser)->type == CPP_COLON))
-c_parser_label (parser);
+  c_parser_all_labels (parser);
   c_parser_statement_after_labels (parser);
 }
 
@@ -5090,11 +5098,7 @@ c_parser_if_body (c_parser *parser, bool *if_p)
 {
   tree block = c_begin_compound_stmt (flag_isoc99);
   location_t body_loc = c_parser_peek_token (parser)->location;
-  while (c_parser_next_token_is_keyword (parser, RID_CASE)
-|| c_parser_next_token_is_keyword (parser, RID_DEFAULT)
-|| (c_parser_next_token_is (parser, CPP_NAME)
-&& c_parser_peek_2nd_token (parser)->type == CPP_COLON))
-c_parser_label (parser);
+  c_parser_all_labels (parser);
   *if_p = c_parser_next_token_is_keyword (parser, RID_IF);
   if (c_parser_next_token_is (parser, CPP_SEMICOLON))
 {
@@ -5121,11 +5125,7 @@ c_parser_else_body (c_parser *parser)
 {
   location_t else_loc = c_parser_peek_token (parser)->location;
   tree block = c_begin_compound_stmt (flag_isoc99);
-  while (c_parser_next_token_is_keyword (parser, RID_CASE)
-|| c_parser_next_token_is_keyword (parser, RID_DEFAULT)
-|| (c_parser_next_token_is (parser, CPP_NAME)
-&& c_parser_peek_2nd_token (parser)->type == CPP_COLON))
-c_parser_label (parser);
+  c_parser_all_labels (parser);
   if (c_parser_next_token_is (parser, CPP_SEMICOLON))
 {
   location_t loc = c_parser_peek_token (parser)->location;


[PATCH] PR36312

2014-10-18 Thread Anthony Brandon
Hi,
I'm a new contributor and I don't yet have a copyright assignment or
commit access.
I took the patch from
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36312 and made some
changes.
This patch makes GCC check if any of the input files is the same as
the output file specified with -o, and if so give an error message
rather than overwrite the input file.
I moved the canonical_filename_eq to libiberty as suggested in the bug
report, added some comments, and also created a new test case.
Testing for the same input and output file names didn't really seem to
fit into an existing test, so I made a new file based on options.exp.
I'm not sure if there is a better way to do this.

There is still at least one thing that needs to be done, but I
couldn't get it to work and that is to update
libiberty/functions.texi. It says to configure with
--enable-maintainer-mode, and run
make stamp-functions, but I get a no such target error.

I bootstrapped on x86_64-linux and tested.

include/ChangeLog:

2014-10-18  Anthony Brandon  

* filenames.h: Add prototype for canonical_filename_eq.

gcc/ChangeLog:

2014-10-18  Anthony Brandon  

* diagnostic-core.h: Add prototype for fatal_error.
* diagnostic.c (fatal_error): New function fatal_error.
* gcc.c (store_arg): Remove have_o_argbuf_index.
(process_command): Check if input and output files are the same.
* toplev.c (init_asm_output): Check if input and output files
are the same.

gcc/testsuite/ChangeLog:

2014-10-18  Anthony Brandon  

* gcc.misc-tests/output.exp: New test case for identical input
and output files.

libiberty/ChangeLog:

2014-10-18  Anthony Brandon  

* filename_cmp.c (filename_eq): No change.
(canonical_filename_eq): New function to check if file names
are the same.
diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h
index a8245de..2fba279 100644
--- a/gcc/diagnostic-core.h
+++ b/gcc/diagnostic-core.h
@@ -68,6 +68,8 @@ extern void error_n (location_t, int, const char *, const 
char *, ...)
 extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
 extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
  ATTRIBUTE_NORETURN;
+extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3)
+ ATTRIBUTE_NORETURN;
 /* Pass one of the OPT_W* from options.h as the second parameter.  */
 extern bool pedwarn (location_t, int, const char *, ...)
  ATTRIBUTE_GCC_DIAG(3,4);
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 881da0b..1ef95e8 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -1154,6 +1154,23 @@ fatal_error (const char *gmsgid, ...)
   gcc_unreachable ();
 }
 
+/* An error which is severe enough that we make no attempt to
+   continue.  Do not use this for internal consistency checks; that's
+   internal_error.  Use of this function should be rare.  */
+void
+fatal_error (location_t loc, const char *gmsgid, ...)
+{
+  diagnostic_info diagnostic;
+  va_list ap;
+
+  va_start (ap, gmsgid);
+  diagnostic_set_info (&diagnostic, gmsgid, &ap, loc, DK_FATAL);
+  report_diagnostic (&diagnostic);
+  va_end (ap);
+
+  gcc_unreachable ();
+}
+
 /* An internal consistency check has failed.  We make no attempt to
continue.  Note that unless there is debugging value to be had from
a more specific message, or some other good reason, you should use
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 71c76f8..c0f997d 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1702,17 +1702,15 @@ typedef const char *const_char_p; /* For DEF_VEC_P.  */
 
 static vec argbuf;
 
-/* Position in the argbuf vector containing the name of the output file
-   (the value associated with the "-o" flag).  */
-
-static int have_o_argbuf_index = 0;
-
 /* Were the options -c, -S or -E passed.  */
 static int have_c = 0;
 
 /* Was the option -o passed.  */
 static int have_o = 0;
 
+/* Pointer to output file name passed in with -o. */
+static const char *output_file = 0;
+
 /* This is the list of suffixes and codes (%g/%u/%U/%j) and the associated
temp file.  If the HOST_BIT_BUCKET is used for %j, no entry is made for
it here.  */
@@ -1762,8 +1760,6 @@ store_arg (const char *arg, int delete_always, int 
delete_failure)
 {
   argbuf.safe_push (arg);
 
-  if (strcmp (arg, "-o") == 0)
-have_o_argbuf_index = argbuf.length ();
   if (delete_always || delete_failure)
 {
   const char *p;
@@ -3713,6 +3709,7 @@ driver_handle_option (struct gcc_options *opts,
 #if defined(HAVE_TARGET_EXECUTABLE_SUFFIX) || 
defined(HAVE_TARGET_OBJECT_SUFFIX)
   arg = convert_filename (arg, ! have_c, 0);
 #endif
+  output_file = arg;
   /* Save the output name in case -save-temps=obj was used.  */
   save_temps_prefix = xstrdup (arg);
   /* On some systems, ld cannot handle "-o" without a space.  So
@@ -4052,6 +4049,14 @@ process_command (unsigned int decoded_options_count,
   

Re: [PATCH] PR36312

2014-10-18 Thread Anthony Brandon
Never mind about functions.texi. I figured out how to do it.
Here is the new diff and changelog.

libiberty/ChangeLog:

2014-10-18  Anthony Brandon  

* filename_cmp.c (filename_eq): No change.
(canonical_filename_eq): New function to check if file names
are the same.
* functions.texi: Updated with documentation for new function.

gcc/ChangeLog:

2014-10-18  Anthony Brandon  

* diagnostic-core.h: Add prototype for fatal_error.
* diagnostic.c (fatal_error): New function fatal_error.
* gcc.c (store_arg): Remove have_o_argbuf_index.
(process_command): Check if input and output files are the same.
* toplev.c (init_asm_output): Check if input and output files
are the same.

gcc/testsuite/ChangeLog:

2014-10-18  Anthony Brandon  

* gcc.misc-tests/output.exp: New test case for identical input
and output files.

include/ChangeLog:

2014-10-18  Anthony Brandon  

* filenames.h: Add prototype for canonical_filename_eq.

On Sat, Oct 18, 2014 at 12:48 PM, Anthony Brandon
 wrote:
> Hi,
> I'm a new contributor and I don't yet have a copyright assignment or
> commit access.
> I took the patch from
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36312 and made some
> changes.
> This patch makes GCC check if any of the input files is the same as
> the output file specified with -o, and if so give an error message
> rather than overwrite the input file.
> I moved the canonical_filename_eq to libiberty as suggested in the bug
> report, added some comments, and also created a new test case.
> Testing for the same input and output file names didn't really seem to
> fit into an existing test, so I made a new file based on options.exp.
> I'm not sure if there is a better way to do this.
>
> There is still at least one thing that needs to be done, but I
> couldn't get it to work and that is to update
> libiberty/functions.texi. It says to configure with
> --enable-maintainer-mode, and run
> make stamp-functions, but I get a no such target error.
>
> I bootstrapped on x86_64-linux and tested.
>
> include/ChangeLog:
>
> 2014-10-18  Anthony Brandon  
>
>     * filenames.h: Add prototype for canonical_filename_eq.
>
> gcc/ChangeLog:
>
> 2014-10-18  Anthony Brandon  
>
> * diagnostic-core.h: Add prototype for fatal_error.
> * diagnostic.c (fatal_error): New function fatal_error.
> * gcc.c (store_arg): Remove have_o_argbuf_index.
> (process_command): Check if input and output files are the same.
>     * toplev.c (init_asm_output): Check if input and output files
> are the same.
>
> gcc/testsuite/ChangeLog:
>
> 2014-10-18  Anthony Brandon  
>
> * gcc.misc-tests/output.exp: New test case for identical input
> and output files.
>
> libiberty/ChangeLog:
>
> 2014-10-18  Anthony Brandon  
>
> * filename_cmp.c (filename_eq): No change.
> (canonical_filename_eq): New function to check if file names
> are the same.



-- 
Anthony
diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h
index a8245de..2fba279 100644
--- a/gcc/diagnostic-core.h
+++ b/gcc/diagnostic-core.h
@@ -68,6 +68,8 @@ extern void error_n (location_t, int, const char *, const 
char *, ...)
 extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
 extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
  ATTRIBUTE_NORETURN;
+extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3)
+ ATTRIBUTE_NORETURN;
 /* Pass one of the OPT_W* from options.h as the second parameter.  */
 extern bool pedwarn (location_t, int, const char *, ...)
  ATTRIBUTE_GCC_DIAG(3,4);
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 881da0b..1ef95e8 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -1154,6 +1154,23 @@ fatal_error (const char *gmsgid, ...)
   gcc_unreachable ();
 }
 
+/* An error which is severe enough that we make no attempt to
+   continue.  Do not use this for internal consistency checks; that's
+   internal_error.  Use of this function should be rare.  */
+void
+fatal_error (location_t loc, const char *gmsgid, ...)
+{
+  diagnostic_info diagnostic;
+  va_list ap;
+
+  va_start (ap, gmsgid);
+  diagnostic_set_info (&diagnostic, gmsgid, &ap, loc, DK_FATAL);
+  report_diagnostic (&diagnostic);
+  va_end (ap);
+
+  gcc_unreachable ();
+}
+
 /* An internal consistency check has failed.  We make no attempt to
continue.  Note that unless there is debugging value to be had from
a more specific message, or some other good reason, you should use
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 71c76f8..c0f997d 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1702,17 +1702,15 @@ typedef const char *const_char_p; /* For DEF_VEC_P.  */
 
 static vec argbuf;
 
-/* Position in th

Re: [PATCH] PR36312

2014-10-18 Thread Anthony Brandon
I didn't start the paper work yet. I'll get started on it.
For the changelog entry, I didn't change anything to that function,
but mklog gives an entry for it.
I think it's because the new function is added after it and at the end
if the file.


On Sat, Oct 18, 2014 at 3:15 PM, Marc Glisse  wrote:
> On Sat, 18 Oct 2014, Anthony Brandon wrote:
>
>> I'm a new contributor
>
>
> Welcome!
>
>> I don't yet have a copyright assignment
>
>
> Did you start the paperwork?
>
>>* filename_cmp.c (filename_eq): No change.
>
>
> I didn't look at the patch, but that's a confusing ChangeLog entry. Did you
> change something or not? ;-)
>
> --
> Marc Glisse



-- 
Anthony


Re: [PATCH] PR36312

2014-10-25 Thread Anthony Brandon
Hi,

Sorry for the delay. Here are the updated diff and changelog.

gcc/testsuite/ChangeLog:

2014-10-25  Anthony Brandon  

PR driver/36312
* gcc.misc-tests/output.exp: New test case for identical input and
output files.

include/ChangeLog:

2014-10-25  Anthony Brandon  

PR driver/36312
* filenames.h: Add prototype for canonical_filename_eq.

gcc/ChangeLog:

2014-10-25  Anthony Brandon  

PR driver/36312
* diagnostic-core.h: Add prototype for fatal_error.
* diagnostic.c (fatal_error): New function fatal_error.
* gcc.c (store_arg): Remove have_o_argbuf_index.
(process_command): Check if input and output files are the same.
* toplev.c (init_asm_output): Check if input and output files are the same.

libiberty/ChangeLog:

2014-10-25  Anthony Brandon  

PR driver/36312
* filename_cmp.c (canonical_filename_eq): New function to check if
file names are the same.
* functions.texi: Updated with documentation for new function.

On Sun, Oct 19, 2014 at 11:17 AM, Manuel López-Ibáñez
 wrote:
> On 18 October 2014 14:43, Anthony Brandon  wrote:
>> Never mind about functions.texi. I figured out how to do it.
>> Here is the new diff and changelog.
>>
>> libiberty/ChangeLog:
>>
>> 2014-10-18  Anthony Brandon  
>>
>> * filename_cmp.c (filename_eq): No change.
>
> Unfortunately mklog is not 100% perfect (actually, it is 'diff -p'
> which is far from perfect). You need to revise that the ChageLog makes
> sense (or make mklog smarter). Thus, drop (filename_eq)...
>
> Also, the changelogs should say PR driver/36312
> (https://gcc.gnu.org/codingconventions.html#ChangeLogs).
>
> I think you need to explain the difference between using fatal_error()
> and fatal_error(UNKNOWN_LOCATION). Yes, I should know because I wrote
> this part of the patch. But to be honest, I don't remember why I did
> this change.
>
> +This function first normalizes the file names so that different file names
> +pointing to the same underlying file are treated as being identical.
>
> I would suggest: "This function compares the canonical versions of the
> filenames as returned by @code{lrealpath()}, so that ..."
>
> I cannot approve the patch, but it looks fine to me. If you don't get
> a reply in a few days, you should ping the relevant maintainers:
> https://gcc.gnu.org/wiki/Community#ping
>
> Great first contribution! What are your plans next?
>
> Cheers,
>
> Manuel.



-- 
Anthony
diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h
index a8245de..2fba279 100644
--- a/gcc/diagnostic-core.h
+++ b/gcc/diagnostic-core.h
@@ -68,6 +68,8 @@ extern void error_n (location_t, int, const char *, const 
char *, ...)
 extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
 extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
  ATTRIBUTE_NORETURN;
+extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3)
+ ATTRIBUTE_NORETURN;
 /* Pass one of the OPT_W* from options.h as the second parameter.  */
 extern bool pedwarn (location_t, int, const char *, ...)
  ATTRIBUTE_GCC_DIAG(3,4);
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 642cbe3..f7f8aaa 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -1163,6 +1163,23 @@ fatal_error (const char *gmsgid, ...)
   gcc_unreachable ();
 }
 
+/* An error which is severe enough that we make no attempt to
+   continue.  Do not use this for internal consistency checks; that's
+   internal_error.  Use of this function should be rare.  */
+void
+fatal_error (location_t loc, const char *gmsgid, ...)
+{
+  diagnostic_info diagnostic;
+  va_list ap;
+
+  va_start (ap, gmsgid);
+  diagnostic_set_info (&diagnostic, gmsgid, &ap, loc, DK_FATAL);
+  report_diagnostic (&diagnostic);
+  va_end (ap);
+
+  gcc_unreachable ();
+}
+
 /* An internal consistency check has failed.  We make no attempt to
continue.  Note that unless there is debugging value to be had from
a more specific message, or some other good reason, you should use
diff --git a/gcc/gcc.c b/gcc/gcc.c
index e013d52..6f144de 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1702,17 +1702,15 @@ typedef const char *const_char_p; /* For DEF_VEC_P.  */
 
 static vec argbuf;
 
-/* Position in the argbuf vector containing the name of the output file
-   (the value associated with the "-o" flag).  */
-
-static int have_o_argbuf_index = 0;
-
 /* Were the options -c, -S or -E passed.  */
 static int have_c = 0;
 
 /* Was the option -o passed.  */
 static int have_o = 0;
 
+/* Pointer to output file name passed in with -o. */
+static const char *output_file = 0;
+
 /* This is the list of suffixes and codes (%g/%u/%U/%j) and the associated
temp file.  If the HOST_BIT_BUCKET is used for %j, no entry is made for
it here.  */
@@ -1762,8 +

Re: [PATCH] PR36312

2014-11-06 Thread Anthony Brandon
It looks like -soname, and libgnat-5.0.so both end up in the infiles array.
I'm not sure if that's supposed to happen or not.


On Wed, Nov 5, 2014 at 9:57 PM, Eric Botcazou  wrote:
>> 2014-10-25  Anthony Brandon  
>>
>> PR driver/36312
>> * diagnostic-core.h: Add prototype for fatal_error.
>> * diagnostic.c (fatal_error): New function fatal_error.
>> * gcc.c (store_arg): Remove have_o_argbuf_index.
>> (process_command): Check if input and output files are the same.
>> * toplev.c (init_asm_output): Check if input and output files are the
>> same.
>
> This breaks the build of the shared Ada library:
>
> rm -f rts/libgna*.so
> cd rts; `echo "/home/eric/build/gcc/native/./gcc/xgcc -
> B/home/eric/build/gcc/native/./gcc/ -B/home/eric/install/gcc/x86_64-suse-
> linux/bin/ -B/home/eric/install/gcc/x86_64-suse-linux/lib/ -isystem
> /home/eric/install/gcc/x86_64-suse-linux/include -isystem
> /home/eric/install/gcc/x86_64-suse-linux/sys-include   " \
> | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -
> shared -g -O2  \
> -fpic \
> -o libgnat-5.0.so \
> a-assert.o a-btgbso.o a-calari.o a-calcon.o a-caldel.o a-calend.o a-
> calfor.o a-catizo.o a-cbdlli.o a-cbhama.o a-cbhase.o a-cbmutr.o a-cborma.o a-
> cborse.o a-cbprqu.o a-cbsyqu.o a-cdlili.o a-cfdlli.o a-cfhama.o a-cfhase.o a-
> cfinve.o a-cforma.o a-cforse.o a-cgaaso.o a-cgarso.o a-cgcaso.o a-chacon.o a-
> chahan.o a-charac.o a-chlat1.o a-chlat9.o a-chtgbk.o a-chtgbo.o a-chtgke.o a-
> chtgop.o a-chzla1.o a-chzla9.o a-cidlli.o a-cihama.o a-cihase.o a-cimutr.o a-
> ciorma.o a-ciormu.o a-ciorse.o a-clrefi.o a-coboho.o a-cobove.o a-cofove.o a-
> cogeso.o a-cohama.o a-cohase.o a-cohata.o a-coinho.o a-coinve.o a-colien.o a-
> colire.o a-comlin.o a-comutr.o a-contai.o a-convec.o a-coorma.o a-coormu.o a-
> coorse.o a-coprnu.o a-coteio.o a-crbltr.o a-crbtgk.o a-crbtgo.o a-crdlli.o a-
> csquin.o a-cuprqu.o a-cusyqu.o a-cwila1.o a-cwila9.o a-decima.o a-diocst.o a-
> direct.o a-direio.o a-dirval.o a-einuoc.o a-elchha.o a-envvar.o a-except.o a-
> exctra.o a-finali.o a-flteio.o a-fwteio.o a-fzteio.o a-inteio.o a-ioexce.o a-
> iteint.o a-iwteio.o a-izteio.o a-lcteio.o a-lfteio.o a-lfwtio.o a-lfztio.o a-
> liteio.o a-liwtio.o a-liztio.o a-llctio.o a-llftio.o a-llfwti.o a-llfzti.o a-
> llitio.o a-lliwti.o a-llizti.o a-locale.o a-ncelfu.o a-ngcefu.o a-ngcoar.o a-
> ngcoty.o a-ngelfu.o a-ngrear.o a-nlcefu.o a-nlcoar.o a-nlcoty.o a-nlelfu.o a-
> nllcar.o a-nllcef.o a-nllcty.o a-nllefu.o a-nllrar.o a-nlrear.o a-nscefu.o a-
> nscoty.o a-nselfu.o a-nucoar.o a-nucoty.o a-nudira.o a-nuelfu.o a-nuflra.o a-
> numaux.o a-numeri.o a-nurear.o a-rbtgbk.o a-rbtgbo.o a-rbtgso.o a-sbecin.o a-
> sbhcin.o a-sblcin.o a-scteio.o a-secain.o a-sequio.o a-sfecin.o a-sfhcin.o a-
> sflcin.o a-sfteio.o a-sfwtio.o a-sfztio.o a-shcain.o a-siocst.o a-siteio.o a-
> siwtio.o a-siztio.o a-slcain.o a-ssicst.o a-ssitio.o a-ssiwti.o a-ssizti.o a-
> stboha.o a-stfiha.o a-stmaco.o a-storio.o a-strbou.o a-stream.o a-strfix.o a-
> strhas.o a-string.o a-strmap.o a-strsea.o a-strsup.o a-strunb.o a-ststio.o a-
> stunau.o a-stunha.o a-stuten.o a-stwibo.o a-stwifi.o a-stwiha.o a-stwima.o a-
> stwise.o a-stwisu.o a-stwiun.o a-stzbou.o a-stzfix.o a-stzhas.o a-stzmap.o a-
> stzsea.o a-stzsup.o a-stzunb.o a-suecin.o a-suenco.o a-suenst.o a-suewst.o a-
> suezst.o a-suhcin.o a-sulcin.o a-suteio.o a-swbwha.o a-swfwha.o a-swmwco.o a-
> swunau.o a-swuwha.o a-swuwti.o a-szbzha.o a-szfzha.o a-szmzco.o a-szunau.o a-
> szuzha.o a-szuzti.o a-tags.o a-teioed.o a-textio.o a-tgdico.o a-tiboio.o a-
> ticoau.o a-ticoio.o a-tideau.o a-tideio.o a-tienau.o a-tienio.o a-tifiio.o a-
> tiflau.o a-tiflio.o a-tigeau.o a-tiinau.o a-tiinio.o a-timoau.o a-timoio.o a-
> tiocst.o a-tirsfi.o a-titest.o a-tiunio.o a-unccon.o a-uncdea.o a-undesu.o a-
> wichha.o a-wichun.o a-widcha.o a-witeio.o a-wrstfi.o a-wtcoau.o a-wtcoio.o a-
> wtcstr.o a-wtdeau.o a-wtdeio.o a-wtedit.o a-wtenau.o a-wtenio.o a-wtfiio.o a-
> wtflau.o a-wtflio.o a-wtgeau.o a-wtinau.o a-wtinio.o a-wtmoau.o a-wtmoio.o a-
> wttest.o a-wwboio.o a-wwunio.o a-zchara.o a-zchhan.o a-zchuni.o a-zrstfi.o a-
> ztcoau.o a-ztcoio.o a-ztcstr.o a-ztdeau.o a-ztdeio.o a-ztedit.o a-ztenau.o a-
> ztenio.o a-ztexio.o a-ztfiio.o a-ztflau.o a-ztflio.o a-ztgeau.o a-ztinau.o a-
> ztinio.o a-ztmoau.o a-ztmoio.o a-zttest.o a-zzboio.o a-zzunio.o ada.o
> calendar.o directio.o g-arrspl.o g-awk.o g-bubsor.o g-busora.o g-busorg.o g-
> byorma.o g-bytswa.o g-calend.o g-casuti.o g-catiio.o g-cgi.o g-cgicoo.o g-
> cgideb.o g-comlin.o g-comver.o g-crc32.o g-ctrl_c.o g-curexc.o g-debpoo.o g-
> debuti.o g-decstr.o g-deutst.o g-diopit.o g-dirope.o g-dynhta.o g-dyntab.o g-
> encstr.o g-enut

Re: [PATCH] PR36312

2014-11-06 Thread Anthony Brandon
Sorry, I didn't realize the default didn't build all languages. I will
configure with --enable-languages=all from now on.


On Thu, Nov 6, 2014 at 1:26 AM, Manuel López-Ibáñez
 wrote:
> On 5 November 2014 21:57, Eric Botcazou  wrote:
>>> 2014-10-25  Anthony Brandon  
>>>
>>> PR driver/36312
>>> * diagnostic-core.h: Add prototype for fatal_error.
>>> * diagnostic.c (fatal_error): New function fatal_error.
>>> * gcc.c (store_arg): Remove have_o_argbuf_index.
>>> (process_command): Check if input and output files are the same.
>>> * toplev.c (init_asm_output): Check if input and output files are the
>>> same.
>>
>> This breaks the build of the shared Ada library:
>
> It seems the driver adds as input files all the flags passed to the
> linker, things such as "-lm", "-soname" and "libgnat-5.0.so". Very
> intuitive, not. At least these fake files are marked with '*', so the
> following on top of the patch should work:
>
> Index: gcc.c
> ===
> --- gcc.c   (revision 217149)
> +++ gcc.c   (working copy)
> @@ -4051,11 +4051,12 @@ process_command (unsigned int decoded_op
>
>if (output_file && strcmp (output_file, "-"))
>  {
>int i;
>for (i = 0; i < n_infiles; i++)
> -   if (canonical_filename_eq (infiles[i].name, output_file))
> +   if (infiles[i].language && infiles[i].language[0] != '*'
> +   && canonical_filename_eq (infiles[i].name, output_file))
>   fatal_error ("output file %s is the same as input file", 
> output_file);
>  }
>
>/* If -save-temps=obj and -o name, create the prefix to use for %b.
>   Otherwise just make -save-temps=obj the same as -save-temps=cwd.  */
>
> Testing now.
>
> Cheers,
>
> Manuel.



-- 
Anthony