* [PATCH] sim: use character classes rather than ranges
@ 2012-03-19 4:54 Mike Frysinger
2012-03-19 11:52 ` Joseph S. Myers
0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2012-03-19 4:54 UTC (permalink / raw)
To: gdb-patches
A-Z ranges don't work in all locales, so use character classes instead.
Committed.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-19 Mike Frysinger <vapier@gentoo.org>
* Make-common.in (TAGS): Change a-z to [:lower:].
* acinclude.m4 (sim-trace): Likewise.
* gennltvals.sh: Change A-Z0-9 to [:upper:][:digit:]. Change
A-Za-z0-9 to [:alnum:].
---
sim/common/Make-common.in | 2 +-
sim/common/acinclude.m4 | 2 +-
sim/common/gennltvals.sh | 32 ++++++++++++++++----------------
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index c11e51e..1a3a6b6 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -518,7 +518,7 @@ tags etags: TAGS
# And the sim-n-foo.h files create functions that can't be found either.
TAGS: force
cd $(srcdir) && \
- etags --regex '/^\([a-z_]+\) (/\1/' --regex '/^\/[*] TAGS: .*/' \
+ etags --regex '/^\([[:lower:]_]+\) (/\1/' --regex '/^\/[*] TAGS: .*/' \
*.[ch] ../common/*.[ch]
clean: $(SIM_EXTRA_CLEAN)
diff --git a/sim/common/acinclude.m4 b/sim/common/acinclude.m4
index efb1a29..20155ad 100644
--- a/sim/common/acinclude.m4
+++ b/sim/common/acinclude.m4
@@ -178,7 +178,7 @@ AC_ARG_ENABLE(sim-trace,
no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
[[-0-9]]*)
sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
- [[a-z]]*)
+ [[[:lower:]]]*)
sim_trace=""
for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
if test x"$sim_trace" = x; then
diff --git a/sim/common/gennltvals.sh b/sim/common/gennltvals.sh
index bbab145..9036cf3 100644
--- a/sim/common/gennltvals.sh
+++ b/sim/common/gennltvals.sh
@@ -14,13 +14,13 @@ echo '/* Newlib/libgloss macro values needed by remote target support. */'
echo '/* This file is machine generated by gennltvals.sh. */'
$shell ${srccom}/gentvals.sh "" errno ${srcroot}/newlib/libc/include \
- "errno.h sys/errno.h" 'E[A-Z0-9]*' "${cpp}"
+ "errno.h sys/errno.h" 'E[[:upper:][:digit:]]*' "${cpp}"
$shell ${srccom}/gentvals.sh "" signal ${srcroot}/newlib/libc/include \
- "signal.h sys/signal.h" 'SIG[A-Z0-9]*' "${cpp}"
+ "signal.h sys/signal.h" 'SIG[[:upper:][:digit:]]*' "${cpp}"
$shell ${srccom}/gentvals.sh "" open ${srcroot}/newlib/libc/include \
- "fcntl.h sys/fcntl.h sys/_default_fcntl.h" 'O_[A-Z0-9]*' "${cpp}"
+ "fcntl.h sys/fcntl.h sys/_default_fcntl.h" 'O_[[:upper:][:digit:]]*' "${cpp}"
# Unfortunately, each newlib/libgloss port has seen fit to define their own
# syscall.h file. This means that system call numbers can vary for each port.
@@ -31,52 +31,52 @@ $shell ${srccom}/gentvals.sh "" open ${srcroot}/newlib/libc/include \
dir=libgloss target=bfin
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
- "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+ "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
dir=newlib/libc/sys/d10v/sys target=d10v
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
- "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+ "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
# OBSOLETE dir=libgloss target=d30v
# OBSOLETE $shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
-# OBSOLETE "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+# OBSOLETE "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
dir=libgloss target=cr16
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
- "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+ "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
dir=libgloss target=fr30
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
- "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+ "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
dir=libgloss target=frv
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
- "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+ "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
dir=libgloss/i960 target=i960
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
- "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+ "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
dir=libgloss target=m32r
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
- "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+ "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
dir=libgloss target=mn10200
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
- "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+ "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
dir=libgloss target=mn10300
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
- "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+ "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
dir=libgloss target=sparc
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
- "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+ "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
dir=libgloss/v850/sys target=v850
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
- "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+ "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
dir=libgloss target=lm32
$shell ${srccom}/gentvals.sh $target sys ${srcroot}/$dir \
- "syscall.h" 'SYS_[_A-Za-z0-9]*' "${cpp}"
+ "syscall.h" 'SYS_[_[:alnum:]]*' "${cpp}"
--
1.7.8.5
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] sim: use character classes rather than ranges
2012-03-19 4:54 [PATCH] sim: use character classes rather than ranges Mike Frysinger
@ 2012-03-19 11:52 ` Joseph S. Myers
2012-03-19 15:07 ` Mike Frysinger
0 siblings, 1 reply; 3+ messages in thread
From: Joseph S. Myers @ 2012-03-19 11:52 UTC (permalink / raw)
To: Mike Frysinger; +Cc: gdb-patches
On Mon, 19 Mar 2012, Mike Frysinger wrote:
> A-Z ranges don't work in all locales, so use character classes instead.
Are these patterns really meant to depend on the user's locale (and
support locale-specific letters) or are they related to the checked-in
source code (in which case they should support just ASCII letters and
digits - either the relevant program should be run in the C locale, or as
in GCC's option-handling awk scripts the full sets of letters and digits
should be given explicitly somewhere)?
(Using character classes like you do is fine - *if* either the user's
locale is correct for this code or the programs explicitly run in the C
locale.)
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sim: use character classes rather than ranges
2012-03-19 11:52 ` Joseph S. Myers
@ 2012-03-19 15:07 ` Mike Frysinger
0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2012-03-19 15:07 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gdb-patches
[-- Attachment #1: Type: Text/Plain, Size: 1227 bytes --]
On Monday 19 March 2012 07:52:08 Joseph S. Myers wrote:
> On Mon, 19 Mar 2012, Mike Frysinger wrote:
> > A-Z ranges don't work in all locales, so use character classes instead.
>
> Are these patterns really meant to depend on the user's locale (and
> support locale-specific letters) or are they related to the checked-in
> source code (in which case they should support just ASCII letters and
> digits - either the relevant program should be run in the C locale, or as
> in GCC's option-handling awk scripts the full sets of letters and digits
> should be given explicitly somewhere)?
>
> (Using character classes like you do is fine - *if* either the user's
> locale is correct for this code or the programs explicitly run in the C
> locale.)
some are meant for processing source files which get checked in while others
are processing user flags. the gennltvals.sh script could be made to work by
forcing a C locale, but the configure script would be tricky.
these changes might over match input if the processed source is wrong, but for
all correct inputs, these groups should give the same output regardless of
locale which is why i didn't try going the mess-with-active-locale route.
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-19 15:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-19 4:54 [PATCH] sim: use character classes rather than ranges Mike Frysinger
2012-03-19 11:52 ` Joseph S. Myers
2012-03-19 15:07 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox