public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: rkl@connect.org.uk
To: gcc-gnats@gcc.gnu.org
Subject: c++/4094: LHS conditional in assignment in gcc/cp/decl.c
Date: Thu, 23 Aug 2001 07:26:00 -0000	[thread overview]
Message-ID: <20010823142328.10088.qmail@sourceware.cygnus.com> (raw)

>Number:         4094
>Category:       c++
>Synopsis:       LHS conditional in assignment in gcc/cp/decl.c
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 23 07:26:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     rkl@connect.org.uk
>Release:        3.0.1
>Organization:
>Environment:
HP-UX 11.00, HP ANSI C - other strict K&R/ANSI C compilers
may comaplain too.
>Description:
With HP's ANSI C in HP-UX 11.00, you're not allowed this
construct:

(a?b:c) = 0;

In other words, conditional LHS assignments are prohibited.

Unfortunately, gcc/cp/decl.c is scattered throughout with
them, all relating to the current_binding_level macro,
which appears on the LHS of an assignment about a dozen
times.
>How-To-Repeat:
Compile 3.0.1 with a strict K&R or ANSI C compiler - I used
HP's ANSI C in HP-UX 11.00 for this.
>Fix:
I created a new macro just below the #define current_binding_level line:

#define assign_current_binding_level(rhs)       \
  if (cfun && cp_function_chain->bindings)      \
   cp_function_chain->bindings=rhs;             \
   else scope_chain->bindings=rhs

I then found every occurrence of current_binding_level on
the LHS of an assignment and replaced it with a call
to the new macro instead. For example:

Line 528 was:

  current_binding_level = newlevel;

and is now:

  assign_current_binding_level(newlevel);


>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2001-08-23  7:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-23  7:26 rkl [this message]
2001-09-02  1:50 rodrigc
2002-11-29 19:06 bangerth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010823142328.10088.qmail@sourceware.cygnus.com \
    --to=rkl@connect.org.uk \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).