From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1386) id 3993A3858C2F; Tue, 16 Aug 2022 07:13:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3993A3858C2F Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jan Beulich To: bfd-cvs@sourceware.org Subject: [binutils-gdb] revert "x86: Also pass -P to $(CPP) when processing i386-opc.tbl" X-Act-Checkin: binutils-gdb X-Git-Author: Jan Beulich X-Git-Refname: refs/heads/master X-Git-Oldrev: 246cb4b5a18559882cba41f364f08ab4f838d853 X-Git-Newrev: 33b6a20af3854e1aa144fbfca6ff98fccd0ef86d Message-Id: <20220816071326.3993A3858C2F@sourceware.org> Date: Tue, 16 Aug 2022 07:13:26 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2022 07:13:26 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D33b6a20af385= 4e1aa144fbfca6ff98fccd0ef86d commit 33b6a20af3854e1aa144fbfca6ff98fccd0ef86d Author: Jan Beulich Date: Tue Aug 16 09:11:18 2022 +0200 revert "x86: Also pass -P to $(CPP) when processing i386-opc.tbl" =20 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. Diff: --- opcodes/Makefile.am | 2 +- opcodes/Makefile.in | 2 +- opcodes/i386-gen.c | 35 +++++++++++++++++++++++++++-------- opcodes/i386-opc.tbl | 49 +++++++++++++++++++++++++++---------------------- 4 files changed, 56 insertions(+), 32 deletions(-) diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am index af843fb3786..87be5e7edb2 100644 --- a/opcodes/Makefile.am +++ b/opcodes/Makefile.am @@ -559,7 +559,7 @@ $(srcdir)/i386-tbl.h: $(srcdir)/i386-init.h @echo $@ =20 $(srcdir)/i386-init.h: @MAINT@ i386-gen$(EXEEXT_FOR_BUILD) i386-opc.tbl i3= 86-reg.tbl i386-opc.h - $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLA= GS) - \ + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)= - \ < $(srcdir)/i386-opc.tbl \ | ./i386-gen$(EXEEXT_FOR_BUILD) --srcdir $(srcdir) =20 diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in index 2257b0872af..581747edb7b 100644 --- a/opcodes/Makefile.in +++ b/opcodes/Makefile.in @@ -1534,7 +1534,7 @@ $(srcdir)/i386-tbl.h: $(srcdir)/i386-init.h @echo $@ =20 $(srcdir)/i386-init.h: @MAINT@ i386-gen$(EXEEXT_FOR_BUILD) i386-opc.tbl i3= 86-reg.tbl i386-opc.h - $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLA= GS) - \ + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)= - \ < $(srcdir)/i386-opc.tbl \ | ./i386-gen$(EXEEXT_FOR_BUILD) --srcdir $(srcdir) =20 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) =3D=3D NULL) break; =20 - lineno++; - p =3D remove_leading_whitespaces (buf); =20 - /* Skip comments. */ - str =3D strstr (p, "//"); - if (str !=3D NULL) - str[0] =3D '\0'; + for ( ; ; ) + { + lineno++; =20 - /* Remove trailing white spaces. */ - remove_trailing_whitespaces (p); + /* Skip comments. */ + str =3D strstr (p, "//"); + if (str !=3D NULL) + { + str[0] =3D '\0'; + remove_trailing_whitespaces (p); + break; + } + + /* Look for line continuation character. */ + remove_trailing_whitespaces (p); + j =3D strlen (buf); + if (!j || buf[j - 1] !=3D '+') + break; + if (j >=3D sizeof (buf) - 1) + fail (_("%s: %d: (continued) line too long\n"), filename, lineno); + + if (fgets (buf + j - 1, sizeof (buf) - j + 1, fp) =3D=3D NULL) + { + fprintf (stderr, "%s: Line continuation on last line?\n", + filename); + break; + } + } =20 switch (p[0]) { diff --git a/opcodes/i386-opc.tbl b/opcodes/i386-opc.tbl index 37704f061ce..12779e651d7 100644 --- a/opcodes/i386-opc.tbl +++ b/opcodes/i386-opc.tbl @@ -22,6 +22,11 @@ #include "i386-opc.h" #undef None =20 +// When necessary lines can be split in a non-standard way, by placing a +// trailing + on a to-be-continued line. This is intended mainly for non-= insn +// templates. Insn templates are better kept all on one line to make grep= and +// alike produce useful results. + #define Amd64 ISA64=3DAMD64 #define Intel64 ISA64=3DINTEL64 #define Intel64Only ISA64=3DINTEL64ONLY @@ -455,7 +460,7 @@ enter, 0xc8, None, Cpu64, DefaultSize|No_bSuf|No_lSuf|N= o_sSuf|No_ldSuf|NoRex64, leave, 0xc9, None, Cpu186|CpuNo64, DefaultSize|No_bSuf|No_sSuf|No_qSuf|No_= ldSuf, {} leave, 0xc9, None, Cpu64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|No_ldSuf|NoR= ex64, {} =20 - =20 // Conditional jumps. @@ -871,9 +876,9 @@ rex.wrxb, 0x4f, None, Cpu64, No_bSuf|No_wSuf|No_lSuf|No= _sSuf|No_qSuf|No_ldSuf|Is =20 // Pseudo prefixes (base_opcode =3D=3D PSEUDO_PREFIX) =20 - =20 {}, PSEUDO_PREFIX, Prefix_, , N= o_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsPrefix, {} @@ -962,13 +967,13 @@ pause, 0xf390, None, Cpu186, No_bSuf|No_wSuf|No_lSuf|= No_sSuf|No_qSuf|No_ldSuf, { =20 // MMX/SSE2 instructions. =20 - =20 - =20 emms, 0xf77, None, CpuMMX, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSu= f, {} @@ -1052,8 +1057,8 @@ pxor, 0x0fef, None, , Modrm||C|No_bSuf|No_wSuf| =20 // SSE instructions. =20 - =20 @@ -1309,9 +1314,9 @@ invpcid, 0x660f3882, None, CpuINVPCID|Cpu64, Modrm|No= _bSuf|No_wSuf|No_lSuf|No_qS =20 // SSSE3 instructions. =20 - =20 phaddw, 0x0f3801, None, , Modrm||= |No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { ||Unspecified|BaseIndex, } @@ -1469,14 +1474,14 @@ gf2p8mulb, 0x660f38cf, None, CpuGFN= I, Modrm||No_bSuf|No =20 // AVX instructions. =20 - =20 vaddpd, 0x6658, None, CpuAVX, Modrm|Vex|Space0F|VexVVVV=3D1|VexWIG|CheckRe= gSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Unspecified|BaseI= ndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM }