summaryrefslogtreecommitdiff
path: root/opcodes/i386-gen.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-08-16 09:11:18 +0200
committerJan Beulich <jbeulich@suse.com>2022-08-16 09:11:18 +0200
commit33b6a20af3854e1aa144fbfca6ff98fccd0ef86d (patch)
tree67b9fd12c0e001483558ea32d15c3bc3fab23473 /opcodes/i386-gen.c
parent246cb4b5a18559882cba41f364f08ab4f838d853 (diff)
downloadbinutils-gdb-33b6a20af3854e1aa144fbfca6ff98fccd0ef86d.tar.gz
revert "x86: Also pass -P to $(CPP) when processing i386-opc.tbl"
This reverts commit 384f368958f2a5bb083660e58e5f8a010e6ad429, which broke i386-gen's emitting of diagnostics. As a replacement to address the original issue of newer gcc no longer splicing lines when dropping the line continuation backslashes, switch to using + as the line continuation character, doing the line splicing in i386-gen.
Diffstat (limited to 'opcodes/i386-gen.c')
-rw-r--r--opcodes/i386-gen.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c
index 3390d82f59b..eaeb207e444 100644
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -1764,17 +1764,36 @@ process_i386_opcodes (FILE *table)
if (fgets (buf, sizeof (buf), fp) == NULL)
break;
- lineno++;
-
p = remove_leading_whitespaces (buf);
- /* Skip comments. */
- str = strstr (p, "//");
- if (str != NULL)
- str[0] = '\0';
+ for ( ; ; )
+ {
+ lineno++;
- /* Remove trailing white spaces. */
- remove_trailing_whitespaces (p);
+ /* Skip comments. */
+ str = strstr (p, "//");
+ if (str != NULL)
+ {
+ str[0] = '\0';
+ remove_trailing_whitespaces (p);
+ break;
+ }
+
+ /* Look for line continuation character. */
+ remove_trailing_whitespaces (p);
+ j = strlen (buf);
+ if (!j || buf[j - 1] != '+')
+ break;
+ if (j >= sizeof (buf) - 1)
+ fail (_("%s: %d: (continued) line too long\n"), filename, lineno);
+
+ if (fgets (buf + j - 1, sizeof (buf) - j + 1, fp) == NULL)
+ {
+ fprintf (stderr, "%s: Line continuation on last line?\n",
+ filename);
+ break;
+ }
+ }
switch (p[0])
{