diff mbox series

[RISU,v2,07/13] contrib/generate_all: Do not rely on ag

Message ID 20240526193637.459064-8-richard.henderson@linaro.org (mailing list archive)
State New, archived
Headers show
Series ELF and Sparc64 support | expand

Commit Message

Richard Henderson May 26, 2024, 7:36 p.m. UTC
Use plain grep instead.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 contrib/generate_all.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Peter Maydell May 30, 2024, 1:13 p.m. UTC | #1
On Sun, 26 May 2024 at 20:38, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Use plain grep instead.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  contrib/generate_all.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/generate_all.sh b/contrib/generate_all.sh
> index 651cb23..5ff0b3e 100755
> --- a/contrib/generate_all.sh
> +++ b/contrib/generate_all.sh
> @@ -78,8 +78,8 @@ fi
>
>  mkdir -p ${TARGET_DIR}
>
> -ALL_INSNS=$(cat ${RISU_FILE} | ag "^\w" | cut -f 1 -d " " | sort)
> -COUNT=$(cat ${RISU_FILE=} | ag "^\w" | cut -f 1 -d " " | wc -l)
> +ALL_INSNS=$(cat ${RISU_FILE} | grep "^[A-Za-z]" | cut -f 1 -d " " | sort)
> +COUNT=$(cat ${RISU_FILE=} | grep "^[A-Za-z]" | cut -f 1 -d " " | wc -l)
>  set -- $ALL_INSNS

risugen's definition of the regex matching an insn name in
parse_config_file() is
  ^[A-Za-z0-9][A-Za-z0-9_]*$

I think we should be consistent with that. (PCRE \w isn't
quite the same as it allows a leading underscore and also
various unicode letters, but it's closer than [A-Za-z].)

(As it happens we don't have any current insn patterns
that take advantage of the ability to start with a number.
So if you'd prefer to define insn names starting with a
number to be invalid and change risugen instead that's
fine too.)

thanks
-- PMM
diff mbox series

Patch

diff --git a/contrib/generate_all.sh b/contrib/generate_all.sh
index 651cb23..5ff0b3e 100755
--- a/contrib/generate_all.sh
+++ b/contrib/generate_all.sh
@@ -78,8 +78,8 @@  fi
 
 mkdir -p ${TARGET_DIR}
 
-ALL_INSNS=$(cat ${RISU_FILE} | ag "^\w" | cut -f 1 -d " " | sort)
-COUNT=$(cat ${RISU_FILE=} | ag "^\w" | cut -f 1 -d " " | wc -l)
+ALL_INSNS=$(cat ${RISU_FILE} | grep "^[A-Za-z]" | cut -f 1 -d " " | sort)
+COUNT=$(cat ${RISU_FILE=} | grep "^[A-Za-z]" | cut -f 1 -d " " | wc -l)
 set -- $ALL_INSNS
 
 GROUP=$((COUNT / ${SPLIT}))