9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: 9front@9front.org
Subject: Re: [9front] pcc macro issue
Date: Thu, 21 Jan 2021 10:01:59 -0800	[thread overview]
Message-ID: <A9EF6A793654748550AD3439133D7EB6@eigenstate.org> (raw)
In-Reply-To: <104278AC-1809-4746-B15E-376E33C8E212@gmail.com>

Quoth Xiao-Yong Jin <meta.jxy@gmail.com>:
> The following is wrong.
> 
> cpu% cat test.c
> #define N
> #define F(x)
> #define M F(N)
> M
> cpu% pcc -E test.c
> cpp: test.c:4 Disagreement in number of macro arguments
> #line 1 "/tmp/test.c"
> 
> 
> 
>  F()
> pcc: cpp: cpp 25337: errors
> 

Yep, I fixed a lot of problems in cpp, but this
is one that I didn't get to. Another one is
space handling, which we currently ignore.

	#define MAC(x) y

	MAC(x)	// should expand to y
	MAC (x)	// should remain untouched

ANSI C macro expansion rules are subtle and
arcane. I've got a few tests in my underwhelming
regression suite, which may help if you want
to take a stab at this:

http://shithub.us/git/ori/regress/HEAD/cmd/cpp/f.html


      parent reply	other threads:[~2021-01-21 18:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21  5:59 Xiao-Yong Jin
2021-01-21  6:50 ` Kurt H Maier
2021-01-21 10:48 ` Jonas Amoson
2021-01-21 17:30   ` Xiao-Yong Jin
2021-01-21 18:01 ` ori [this message]

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=A9EF6A793654748550AD3439133D7EB6@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9front@9front.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 NNTP newsgroup(s).