Commit c240b3e0 by Alan Modra Committed by Alan Modra

New obstack_next_free is not an lvalue

New obstack.h casts obstack_next_free to (void *), resulting in it
being a non-lvalue, and warnings on pointer arithmetic.

gcc/
	* gensupport.c (add_mnemonic_string): Make len param a size_t.
	(gen_mnemonic_setattr): Make "size" var a size_t.  Use
	obstack_blank_fast to shrink obstack.  Cast obstack_next_free
	return value.
gcc/objc/
	* objc-encoding.c (encode_aggregate_within): Cast obstack_next_free
	return value.

From-SVN: r229984
parent d4c8d5ed
2015-11-09 Alan Modra <amodra@gmail.com>
* gensupport.c (add_mnemonic_string): Make len param a size_t.
(gen_mnemonic_setattr): Make "size" var a size_t. Use
obstack_blank_fast to shrink obstack. Cast obstack_next_free
return value.
2015-11-09 Segher Boessenkool <segher@kernel.crashing.org> 2015-11-09 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/68182 PR rtl-optimization/68182
...@@ -2253,7 +2253,7 @@ htab_eq_string (const void *s1, const void *s2) ...@@ -2253,7 +2253,7 @@ htab_eq_string (const void *s1, const void *s2)
and a permanent heap copy of STR is created. */ and a permanent heap copy of STR is created. */
static void static void
add_mnemonic_string (htab_t mnemonic_htab, const char *str, int len) add_mnemonic_string (htab_t mnemonic_htab, const char *str, size_t len)
{ {
char *new_str; char *new_str;
void **slot; void **slot;
...@@ -2306,7 +2306,7 @@ gen_mnemonic_setattr (htab_t mnemonic_htab, rtx insn) ...@@ -2306,7 +2306,7 @@ gen_mnemonic_setattr (htab_t mnemonic_htab, rtx insn)
for (i = 0; *cp; ) for (i = 0; *cp; )
{ {
const char *ep, *sp; const char *ep, *sp;
int size = 0; size_t size = 0;
while (ISSPACE (*cp)) while (ISSPACE (*cp))
cp++; cp++;
...@@ -2333,8 +2333,7 @@ gen_mnemonic_setattr (htab_t mnemonic_htab, rtx insn) ...@@ -2333,8 +2333,7 @@ gen_mnemonic_setattr (htab_t mnemonic_htab, rtx insn)
{ {
/* Don't set a value if there are more than one /* Don't set a value if there are more than one
instruction in the string. */ instruction in the string. */
obstack_next_free (&string_obstack) = obstack_blank_fast (&string_obstack, -size);
obstack_next_free (&string_obstack) - size;
size = 0; size = 0;
cp = sp; cp = sp;
...@@ -2346,7 +2345,7 @@ gen_mnemonic_setattr (htab_t mnemonic_htab, rtx insn) ...@@ -2346,7 +2345,7 @@ gen_mnemonic_setattr (htab_t mnemonic_htab, rtx insn)
obstack_1grow (&string_obstack, '*'); obstack_1grow (&string_obstack, '*');
else else
add_mnemonic_string (mnemonic_htab, add_mnemonic_string (mnemonic_htab,
obstack_next_free (&string_obstack) - size, (char *) obstack_next_free (&string_obstack) - size,
size); size);
i++; i++;
} }
......
2015-11-09 Alan Modra <amodra@gmail.com>
* objc-encoding.c (encode_aggregate_within): Cast obstack_next_free
return value.
2015-10-29 Andrew MacLeod <amacleod@redhat.com> 2015-10-29 Andrew MacLeod <amacleod@redhat.com>
* objc-lang.c: Reorder #include's and remove duplicates. * objc-lang.c: Reorder #include's and remove duplicates.
......
...@@ -495,13 +495,14 @@ encode_aggregate_within (tree type, int curtype, int format, int left, ...@@ -495,13 +495,14 @@ encode_aggregate_within (tree type, int curtype, int format, int left,
if (flag_next_runtime) if (flag_next_runtime)
{ {
if (ob_size > 0 && *(obstack_next_free (&util_obstack) - 1) == '^') if (ob_size > 0
&& *((char *) obstack_next_free (&util_obstack) - 1) == '^')
pointed_to = true; pointed_to = true;
if ((format == OBJC_ENCODE_INLINE_DEFS || generating_instance_variables) if ((format == OBJC_ENCODE_INLINE_DEFS || generating_instance_variables)
&& (!pointed_to || ob_size - curtype == 1 && (!pointed_to || ob_size - curtype == 1
|| (ob_size - curtype == 2 || (ob_size - curtype == 2
&& *(obstack_next_free (&util_obstack) - 2) == 'r'))) && *((char *) obstack_next_free (&util_obstack) - 2) == 'r')))
inline_contents = true; inline_contents = true;
} }
else else
...@@ -512,9 +513,10 @@ encode_aggregate_within (tree type, int curtype, int format, int left, ...@@ -512,9 +513,10 @@ encode_aggregate_within (tree type, int curtype, int format, int left,
comment above applies: in that case we should avoid encoding comment above applies: in that case we should avoid encoding
the names of instance variables. the names of instance variables.
*/ */
char c1 = ob_size > 1 ? *(obstack_next_free (&util_obstack) - 2) : 0; char c0, c1;
char c0 = ob_size > 0 ? *(obstack_next_free (&util_obstack) - 1) : 0;
c1 = ob_size > 1 ? *((char *) obstack_next_free (&util_obstack) - 2) : 0;
c0 = ob_size > 0 ? *((char *) obstack_next_free (&util_obstack) - 1) : 0;
if (c0 == '^' || (c1 == '^' && c0 == 'r')) if (c0 == '^' || (c1 == '^' && c0 == 'r'))
pointed_to = true; pointed_to = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment