bugnyacc parser generator - Bugs: bug #59315, comments in structs used in...

 
 

bug #59315: comments in structs used in function parameters

Submitter:  None
Submitted:  Wed 21 Oct 2020 05:51:06 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  mwette
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 09 Jan 2021 02:45:48 PM UTC, comment #2: 

I forgot to close this.  Fixed before 1.03.4.

Matt Wette <mwette>
Group administrator
Wed 21 Oct 2020 07:46:55 PM UTC, comment #1: 

proposed patch against 1.03.1:
diff --git a/module/nyacc/lang/c99/ffi-help.scm b/module/nyacc/lang/c99/ffi-help.scm
index b3652b5..06cd384 100644
--- a/module/nyacc/lang/c99/ffi-help.scm
+++ b/module/nyacc/lang/c99/ffi-help.scm
@@ -783,7 +783,7 @@
                            (udecl (udecl-rem-type-qual udecl))
                            (mdecl (udecl->mdecl udecl)))
                       (mtail->ffi-desc (cdr mdecl))))
-                  fields)))
+                  (clean-fields fields))))
     (((struct-def (ident ,name) ,field-list))
      (mtail->ffi-desc `((struct-def ,field-list))))
    
diff --git a/module/nyacc/lang/c99/munge.scm b/module/nyacc/lang/c99/munge.scm
index eed8ec7..21ec98f 100644
--- a/module/nyacc/lang/c99/munge.scm
+++ b/module/nyacc/lang/c99/munge.scm
@@ -67,7 +67,7 @@
   #:re-export (expand-typerefs
               reify-declr reify-decl
               udecl->mdecl split-udecl
-              clean-field-list)
+              clean-field-list clean-fields)
   #:use-module (nyacc lang c99 cxeval)
   #:use-module (nyacc lang c99 munge-base)
   #:use-module (nyacc lang c99 pprint)

Matt Wette <mwette>
Group administrator
Wed 21 Oct 2020 05:51:06 PM UTC, original submission:  

If a struct declaration contains one or more lines of comments, and that struct is used in a function as a parameter, compile-ffi will crash while processing the code.

Example:

struct foo
{
        // comment
        int bar;
        int baz;
};

void qaz(struct foo zaq);


Processing the code above causes compile-ffi to crash with this error:


Backtrace:
In scripts/compile-ffi.scm:
    233:8 19 (_)
In nyacc/lang/c99/ffi-help.scm:
   2199:4 18 (compile-ffi-file _ _)
In ice-9/ports.scm:
   445:17 17 (call-with-input-file _ _ #:binary _ #:encoding _ # _)
In system/base/compile.scm:
     43:4 16 (call-once _)
In ice-9/boot-9.scm:
    841:4 15 (with-throw-handler _ _ _)
In system/base/compile.scm:
    59:11 14 (_)
In nyacc/lang/c99/ffi-help.scm:
  2215:20 13 (_ #<closed: file 7f9676717d90>)
In unknown file:
          12 (eval (define-ffi-module (test) #:include (quote (#))) #)
In nyacc/lang/c99/ffi-help.scm:
  1966:10 11 (expand-ffi-module-spec (test) ((include "test.h")))
In sxml/fold.scm:
    89:21 10 (fold-values #<procedure 7f9676737400 at nyacc/lang/…> . #)
In ice-9/boot-9.scm:
    829:9  9 (catch ffi-help-error #<procedure 7f9677f3cc80 at nyac…> …)
In nyacc/lang/c99/ffi-help.scm:
   1181:4  8 (cnvt-udecl _ _ ((struct . "foo")) ((struct . "foo") # …))
  1066:22  7 (cnvt-fctn "qaz" (udecl (decl-spec-list (# (void))) #) #)
    826:5  6 (gen-decl-params ((param-decl (decl-spec-list (# …)) #)))
In srfi/srfi-1.scm:
   466:18  5 (fold #<procedure 7f9677ebb280 at nyacc/lang/c99/ffi-h…> …)
In nyacc/lang/c99/ffi-help.scm:
   836:18  4 (_ _ ())
   779:14  3 (mtail->ffi-desc _)
In ice-9/boot-9.scm:
   222:17  2 (map1 ((comment " comment") (comp-decl (# (# #)) (…)) #))
In nyacc/lang/c99/ffi-help.scm:
   781:34  1 (_ _)
In ice-9/boot-9.scm:
   752:25  0 (dispatch-exception _ _ _)

ice-9/boot-9.scm:752:25: In procedure dispatch-exception:
In procedure car: Wrong type argument in position 1 (expecting pair): ()


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mwette (Updated the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-01-09 mwette StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2020-10-21 mwette StatusNone Confirmed
        Assigned toNone mwette

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code