Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [commit] Simplify gdbarch.sh a tiny bit
@ 2003-07-10 22:00 Andrew Cagney
  2003-07-10 23:07 ` Theodore A. Roth
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2003-07-10 22:00 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 203 bytes --]

Hello,

The attached simplfies gdbarch.sh a tiny bit - it uses gdb_assert 
instead of internal_error in a few places (from memory gdbarch.sh was 
written before gdb_assert was added).

committed,
Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 2272 bytes --]

2003-07-10  Andrew Cagney  <cagney@redhat.com>

	* gdbarch.sh: Use gdb_assert instead of internal_error.  Compare
	functions against NULL, not 0.
	* gdbarch.c: Re-generate.
	
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.255
diff -u -r1.255 gdbarch.sh
--- gdbarch.sh	3 Jul 2003 22:14:42 -0000	1.255
+++ gdbarch.sh	10 Jul 2003 21:57:50 -0000
@@ -1733,7 +1733,7 @@
 	then
 	    printf "  return ${predicate};\n"
 	else
-	    printf "  return gdbarch->${function} != 0;\n"
+	    printf "  return gdbarch->${function} != NULL;\n"
 	fi
 	printf "}\n"
     fi
@@ -1749,13 +1749,11 @@
 	fi
 	printf "{\n"
         printf "  gdb_assert (gdbarch != NULL);\n"
-        printf "  if (gdbarch->${function} == 0)\n"
-        printf "    internal_error (__FILE__, __LINE__,\n"
-	printf "                    \"gdbarch: gdbarch_${function} invalid\");\n"
+	printf "  gdb_assert (gdbarch->${function} != NULL);\n"
 	if class_is_predicate_p && test -n "${predicate}"
 	then
 	    # Allow a call to a function with a predicate.
-	    printf "  /* Ignore predicate (${predicate}).  */\n"
+	    printf "  /* Do not check predicate: ${predicate}, allow call.  */\n"
 	fi
 	printf "  if (gdbarch_debug >= 2)\n"
 	printf "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"
@@ -1801,14 +1799,12 @@
 	    printf "  /* Skip verify of ${function}, invalid_p == 0 */\n"
 	elif [ -n "${invalid_p}" ]
 	then
-	  printf "  if (${invalid_p})\n"
-	  printf "    internal_error (__FILE__, __LINE__,\n"
-	  printf "                    \"gdbarch: gdbarch_${function} invalid\");\n"
+	    printf "  /* Check variable is valid.  */\n"
+	    printf "  gdb_assert (!(${invalid_p}));\n"
 	elif [ -n "${predefault}" ]
 	then
-	  printf "  if (gdbarch->${function} == ${predefault})\n"
-	  printf "    internal_error (__FILE__, __LINE__,\n"
-	  printf "                    \"gdbarch: gdbarch_${function} invalid\");\n"
+	    printf "  /* Check variable changed from pre-default.  */\n"
+	    printf "  gdb_assert (gdbarch->${function} != ${predefault});\n"
 	fi
 	printf "  if (gdbarch_debug >= 2)\n"
 	printf "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [commit] Simplify gdbarch.sh a tiny bit
  2003-07-10 22:00 [commit] Simplify gdbarch.sh a tiny bit Andrew Cagney
@ 2003-07-10 23:07 ` Theodore A. Roth
  2003-07-10 23:22   ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Theodore A. Roth @ 2003-07-10 23:07 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches



On Thu, 10 Jul 2003, Andrew Cagney wrote:

> Hello,
>
> The attached simplfies gdbarch.sh a tiny bit - it uses gdb_assert
> instead of internal_error in a few places (from memory gdbarch.sh was
> written before gdb_assert was added).

I'm getting a build failure now:

gcc -c -g -O2    -I. -I../../gdb -I../../gdb/config
-DLOCALEDIR="\"/home/roth/local/avr/share/locale\"" -DHAVE_CONFIG_H
-I../../gdb/../include/opcode -I../../gdb/../readline/.. -I../bfd
-I../../gdb/../bfd  -I../../gdb/../include -I../intl
-I../../gdb/../intl  -DMI_OUT=1 -Wimplicit -Wreturn-type -Wcomment
-Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wuninitialized
-Werror ../../gdb/gdbarch.c
cc1: warnings being treated as errors
../../gdb/gdbarch.c: In function
`gdbarch_deprecated_max_register_raw_size_p':
../../gdb/gdbarch.c:3425: warning: comparison between pointer and integer
../../gdb/gdbarch.c: In function
`gdbarch_deprecated_max_register_virtual_size_p':
../../gdb/gdbarch.c:3448: warning: comparison between pointer and integer
../../gdb/gdbarch.c: In function
`gdbarch_deprecated_call_dummy_stack_adjust_p':
../../gdb/gdbarch.c:3805: warning: comparison between pointer and integer
make: *** [gdbarch.o] Error 1

Is this related to your change?

Ted Roth


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [commit] Simplify gdbarch.sh a tiny bit
  2003-07-10 23:07 ` Theodore A. Roth
@ 2003-07-10 23:22   ` Andrew Cagney
  2003-07-11  1:36     ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2003-07-10 23:22 UTC (permalink / raw)
  To: Theodore A. Roth; +Cc: gdb-patches

> On Thu, 10 Jul 2003, Andrew Cagney wrote:
> 
> 
>> Hello,
>>
>> The attached simplfies gdbarch.sh a tiny bit - it uses gdb_assert
>> instead of internal_error in a few places (from memory gdbarch.sh was
>> written before gdb_assert was added).
> 
> 
> I'm getting a build failure now:

Oh, flip.  The bit to revert should be obvious.  I'm off line for a few 
hours.

Andrew


> gcc -c -g -O2    -I. -I../../gdb -I../../gdb/config
> -DLOCALEDIR="\"/home/roth/local/avr/share/locale\"" -DHAVE_CONFIG_H
> -I../../gdb/../include/opcode -I../../gdb/../readline/.. -I../bfd
> -I../../gdb/../bfd  -I../../gdb/../include -I../intl
> -I../../gdb/../intl  -DMI_OUT=1 -Wimplicit -Wreturn-type -Wcomment
> -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wuninitialized
> -Werror ../../gdb/gdbarch.c
> cc1: warnings being treated as errors
> ../../gdb/gdbarch.c: In function
> `gdbarch_deprecated_max_register_raw_size_p':
> ../../gdb/gdbarch.c:3425: warning: comparison between pointer and integer
> ../../gdb/gdbarch.c: In function
> `gdbarch_deprecated_max_register_virtual_size_p':
> ../../gdb/gdbarch.c:3448: warning: comparison between pointer and integer
> ../../gdb/gdbarch.c: In function
> `gdbarch_deprecated_call_dummy_stack_adjust_p':
> ../../gdb/gdbarch.c:3805: warning: comparison between pointer and integer
> make: *** [gdbarch.o] Error 1
> 
> Is this related to your change?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [commit] Simplify gdbarch.sh a tiny bit
  2003-07-10 23:22   ` Andrew Cagney
@ 2003-07-11  1:36     ` Andrew Cagney
  2003-07-11 15:23       ` Theodore A. Roth
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2003-07-11  1:36 UTC (permalink / raw)
  To: Theodore A. Roth; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1501 bytes --]

> On Thu, 10 Jul 2003, Andrew Cagney wrote:
> 
> 
> Hello,
> 
> The attached simplfies gdbarch.sh a tiny bit - it uses gdb_assert
> instead of internal_error in a few places (from memory gdbarch.sh was
> written before gdb_assert was added).
> 
> 
> I'm getting a build failure now:
> 
> Oh, flip.  The bit to revert should be obvious.  I'm off line for a few hours.

I've checked in the attached.  I'm guessing its correct, my default 
compiler doesn't get these warnings.

Andrew


> gcc -c -g -O2    -I. -I../../gdb -I../../gdb/config
> -DLOCALEDIR="\"/home/roth/local/avr/share/locale\"" -DHAVE_CONFIG_H
> -I../../gdb/../include/opcode -I../../gdb/../readline/.. -I../bfd
> -I../../gdb/../bfd  -I../../gdb/../include -I../intl
> -I../../gdb/../intl  -DMI_OUT=1 -Wimplicit -Wreturn-type -Wcomment
> -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wuninitialized
> -Werror ../../gdb/gdbarch.c
> cc1: warnings being treated as errors
> ../../gdb/gdbarch.c: In function
> `gdbarch_deprecated_max_register_raw_size_p':
> ../../gdb/gdbarch.c:3425: warning: comparison between pointer and integer
> ../../gdb/gdbarch.c: In function
> `gdbarch_deprecated_max_register_virtual_size_p':
> ../../gdb/gdbarch.c:3448: warning: comparison between pointer and integer
> ../../gdb/gdbarch.c: In function
> `gdbarch_deprecated_call_dummy_stack_adjust_p':
> ../../gdb/gdbarch.c:3805: warning: comparison between pointer and integer
> make: *** [gdbarch.o] Error 1
> 
> Is this related to your change?
> 
> 
> 


[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 1804 bytes --]

2003-07-10  Andrew Cagney  <cagney@redhat.com>

	* gdbarch.sh: When a variable, but not a function, compare against
	0.  Fix problem in previous patch.
	* gdbarch.c: Re-generate.
	
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.234
diff -u -r1.234 gdbarch.c
--- gdbarch.c	10 Jul 2003 22:01:14 -0000	1.234
+++ gdbarch.c	11 Jul 2003 01:33:58 -0000
@@ -3422,7 +3422,7 @@
 gdbarch_deprecated_max_register_raw_size_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  return gdbarch->deprecated_max_register_raw_size != NULL;
+  return gdbarch->deprecated_max_register_raw_size != 0;
 }
 
 int
@@ -3445,7 +3445,7 @@
 gdbarch_deprecated_max_register_virtual_size_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  return gdbarch->deprecated_max_register_virtual_size != NULL;
+  return gdbarch->deprecated_max_register_virtual_size != 0;
 }
 
 int
@@ -3802,7 +3802,7 @@
 gdbarch_deprecated_call_dummy_stack_adjust_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  return gdbarch->deprecated_call_dummy_stack_adjust != NULL;
+  return gdbarch->deprecated_call_dummy_stack_adjust != 0;
 }
 
 int
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.256
diff -u -r1.256 gdbarch.sh
--- gdbarch.sh	10 Jul 2003 22:01:14 -0000	1.256
+++ gdbarch.sh	11 Jul 2003 01:33:58 -0000
@@ -1732,7 +1732,11 @@
 	if [ -n "${predicate}" ]
 	then
 	    printf "  return ${predicate};\n"
-	else
+	elif class_is_variable_p
+	then
+	    printf "  return gdbarch->${function} != 0;\n"
+	elif class_is_function_p
+	then
 	    printf "  return gdbarch->${function} != NULL;\n"
 	fi
 	printf "}\n"

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [commit] Simplify gdbarch.sh a tiny bit
  2003-07-11  1:36     ` Andrew Cagney
@ 2003-07-11 15:23       ` Theodore A. Roth
  0 siblings, 0 replies; 5+ messages in thread
From: Theodore A. Roth @ 2003-07-11 15:23 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Theodore A. Roth, gdb-patches



On Thu, 10 Jul 2003, Andrew Cagney wrote:

> > On Thu, 10 Jul 2003, Andrew Cagney wrote:
> >
> >
> > Hello,
> >
> > The attached simplfies gdbarch.sh a tiny bit - it uses gdb_assert
> > instead of internal_error in a few places (from memory gdbarch.sh was
> > written before gdb_assert was added).
> >
> >
> > I'm getting a build failure now:
> >
> > Oh, flip.  The bit to revert should be obvious.  I'm off line for a few hours.
>
> I've checked in the attached.  I'm guessing its correct, my default
> compiler doesn't get these warnings.
>
> Andrew

Yes. Builds fine now.

Thanks.

Ted Roth


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-07-11 15:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-10 22:00 [commit] Simplify gdbarch.sh a tiny bit Andrew Cagney
2003-07-10 23:07 ` Theodore A. Roth
2003-07-10 23:22   ` Andrew Cagney
2003-07-11  1:36     ` Andrew Cagney
2003-07-11 15:23       ` Theodore A. Roth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox