[PATCH] gen-insn-attr-x86.awk: Fix regexp warnings

From: Alexander Kapshuk
Date: Sat Sep 21 2019 - 07:37:38 EST


This patch fixes the regexp warnings shown below:
GEN /home/sasha/torvalds/tools/objtool/arch/x86/lib/inat-tables.c
awk: ../arch/x86/tools/gen-insn-attr-x86.awk:260: warning: regexp escape sequence `\:' is not a known regexp operator
awk: ../arch/x86/tools/gen-insn-attr-x86.awk:350: (FILENAME=../arch/x86/lib/x86-opcode-map.txt FNR=41) warning: regexp escape sequence `\&' is not a known regexp operator

The ':' and '&' characters need not escaping when used in string constants
as part of regular expressions.

[Test-run]
awk -f /home/sasha/torvalds/arch/x86/tools/gen-insn-attr-x86.awk \
/home/sasha/torvalds/arch/x86/lib/x86-opcode-map.txt >tmp/inat-tables.c

diff -U0 /home/sasha/torvalds/tools/objtool/arch/x86/lib/inat-tables.c \
tmp/inat-tables.c; echo $?
0

[Debugging output]
DBG:ext:(66&F2)
DBG:match(ext, ...):(66&F2)
DBG:match(..., lprefix3_expr):\((F2|!F3|66&F2)\)

Signed-off-by: Alexander Kapshuk <alexander.kapshuk@xxxxxxxxx>
---
arch/x86/tools/gen-insn-attr-x86.awk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/tools/gen-insn-attr-x86.awk b/arch/x86/tools/gen-insn-attr-x86.awk
index b02a36b2c14f..a42015b305f4 100644
--- a/arch/x86/tools/gen-insn-attr-x86.awk
+++ b/arch/x86/tools/gen-insn-attr-x86.awk
@@ -69,7 +69,7 @@ BEGIN {

lprefix1_expr = "\\((66|!F3)\\)"
lprefix2_expr = "\\(F3\\)"
- lprefix3_expr = "\\((F2|!F3|66\\&F2)\\)"
+ lprefix3_expr = "\\((F2|!F3|66&F2)\\)"
lprefix_expr = "\\((66|F2|F3)\\)"
max_lprefix = 4

@@ -257,7 +257,7 @@ function convert_operands(count,opnd, i,j,imm,mod)
return add_flags(imm, mod)
}

-/^[0-9a-f]+\:/ {
+/^[0-9a-f]+:/ {
if (NR == 1)
next
# get index
--
2.23.0