unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Matt Wette <matt.wette@gmail.com>
To: Janneke Nieuwenhuizen <janneke@gnu.org>
Cc: guile-user@gnu.org
Subject: Re: [bug nyacc] C99 parser crashes on #warning
Date: Sat, 8 Jun 2024 07:14:24 -0700	[thread overview]
Message-ID: <3308f03b-0290-4116-8c60-447089a2c94e@alumni.caltech.edu> (raw)
In-Reply-To: <878qzfuc6e.fsf@gnu.org>

quick fix (bug #65849)

--- a/module/nyacc/lang/c99/parser.scm
+++ b/module/nyacc/lang/c99/parser.scm
@@ -591,7 +591,7 @@
           ;; If decl mode, only defines and includes outside {}
           ;; @end itemize
           (define (pass-cpp-stmt stmt)
-           (if (eq? 'pragma (car stmt))
+           (if (and (pair? stmt) (eq? 'pragma (car stmt)))
                 (if (eq? mode 'file)
                     `(cpp-stmt ,stmt)
                     `($pragma . ,(cadr stmt)))


On 6/8/24 12:27 AM, Janneke Nieuwenhuizen wrote:
> Hi!
>
> Using the file warning.c:
>
> --8<---------------cut here---------------start------------->8---
> // warning.c
> #warning warn me!
> #warning oops
> --8<---------------cut here---------------end--------------->8---
>
> Nyacc's c99 parser crashes on (right after) the first #warning
>
> --8<---------------cut here---------------start------------->8---
> $ guile
> GNU Guile 3.0.9
> Copyright (C) 1995-2023 Free Software Foundation, Inc.
>
> Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
> This program is free software, and you are welcome to redistribute it
> under certain conditions; type `,show c' for details.
>
> Enter `,help' for help.
> scheme@(guile-user)> ,use (nyacc lang c99 parser)
> scheme@(guile-user)> ,use (nyacc version)
> scheme@(guile-user)> *nyacc-version*
> $1 = "1.09.4"
> scheme@(guile-user)> (with-input-from-file "warning.c" parse-c99)
> warning: warn me!
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> In procedure car: Wrong type argument in position 1 (expecting pair): #<unspecified>
>
> Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
> scheme@(guile-user) [1]> ,bt
> In ice-9/ports.scm:
>     433:17  9 (call-with-input-file _ _ #:binary _ #:encoding _ #:guess-encoding _)
>      472:4  8 (_ _)
> In nyacc/lang/c99/parser.scm:
>      784:6  7 (parse-c99 _ #:cpp-defs _ #:inc-dirs _ #:inc-help _ #:mode _ #:xdef? _ # _ # _ …)
> In ice-9/boot-9.scm:
>    1747:15  6 (with-exception-handler #<procedure 7fa866593180 at ice-9/boot-9.scm:1831:7 (…> …)
>    1747:15  5 (with-exception-handler #<procedure 7fa866593150 at ice-9/boot-9.scm:1831:7 (…> …)
> In nyacc/lang/c99/parser.scm:
>     787:33  4 (_)
> In nyacc/parse.scm:
>     169:37  3 (_ #<procedure 7fa8665a3ee0 at nyacc/lang/c99/parser.scm:376:8 ()> #:debug _)
> In nyacc/lang/c99/parser.scm:
>     697:27  2 (_)
>     594:29  1 (read-token)
> In ice-9/boot-9.scm:
>    1685:16  0 (raise-exception _ #:continuable? _)
> scheme@(guile-user) [1]>
> --8<---------------cut here---------------end--------------->8---
>
> Greetings,
> Janneke
>




  reply	other threads:[~2024-06-08 14:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-08  7:27 [bug nyacc] C99 parser crashes on #warning Janneke Nieuwenhuizen
2024-06-08 14:14 ` Matt Wette [this message]
2024-06-08 20:50   ` Janneke Nieuwenhuizen

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=3308f03b-0290-4116-8c60-447089a2c94e@alumni.caltech.edu \
    --to=matt.wette@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=janneke@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).