bugnyacc parser generator - Bugs: bug #60474, ffi-helper later than 1.03.0 does...

 
 

bug #60474: ffi-helper later than 1.03.0 does not record defined constants

Submitter:  Ricardo Wurmus <rekado>
Submitted:  Thu 29 Apr 2021 06:03:46 AM 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
   

Jump to the original submission

Wed 26 Jan 2022 07:19:33 AM UTC, comment #9: 

comment #7:

> Thanks for the update.  I have confirmed this in my own use.
> I have incorporated into dev-1.07, but maybe will add to 1.06.
> The fix is in module/nyacc/lang/c99/parse.scm: [...]


Excellent! Thank you.

Ricardo Wurmus <rekado>
Wed 26 Jan 2022 07:16:45 AM UTC, comment #8: 

This is surprising to me, but 1.03.7 did not fix this.  1.03.0 is the last version that generates a non-empty drmaa-v1-ffi-symbol-tab.  Surprisingly, commit 1b2f7a2e9cec8ca26 does not fix this.  I tried building with that exact version and all releases that followed, and in none of them is drmaa-v1-ffi-symbol-tab filled.


Ricardo Wurmus <rekado>
Wed 26 Jan 2022 01:27:39 AM UTC, comment #7: 

Thanks for the update.  I have confirmed this in my own use.
I have incorporated into dev-1.07, but maybe will add to 1.06.
The fix is in module/nyacc/lang/c99/parse.scm:

-- a/module/nyacc/lang/c99/parser.scm
+++ b/module/nyacc/lang/c99/parser.scm
@@ -574,7 +574,7 @@
                  ((code) #f)
                  ((decl)
                   (and (cpi-top-blev? info)
-                       (memq (car stmt) '(include include-next define))
+                       (memq (car stmt) '(include include-next))
                    `(cpp-stmt . ,stmt)))
                  ((file)
                   (and (or (cpi-top-blev? info)

Matt Wette <mwette>
Group administrator
Tue 25 Jan 2022 10:42:15 PM UTC, comment #6: 

It looks like this has regressed.  In version 1.05.1 it no longer extracts a list of defines from the headers.  The value of drmaa-v1-ffi-symbol-tab is again the empty list.

I'll try to figure out in which release the regression occurred.

Ricardo Wurmus <rekado>
Mon 31 May 2021 01:44:59 PM UTC, comment #5: 

The latest release works fine.  Thank you!

Ricardo Wurmus <rekado>
Fri 21 May 2021 03:23:29 PM UTC, comment #4: 

Here is the relevant patch:
$ git diff V1.03.6 -- ffi-help.scm
diff --git a/module/nyacc/lang/c99/ffi-help.scm b/module/nyacc/lang/c99/ffi-help.scm
index 92404f9..b8895d7 100644
--- a/module/nyacc/lang/c99/ffi-help.scm
+++ b/module/nyacc/lang/c99/ffi-help.scm
@@ -1130,8 +1130,8 @@
                              (or (equal? node '(stor-spec (auto)))
                                  (equal? node '(stor-spec (register)))
                                  (equal? node '(stor-spec (static)))
-                                 (and (pair? node)
-                                      (equal? (car node) 'type-qual))))
+                                 (equal? node '(type-qual "volatile"))
+                                 (equal? node '(type-qual "restrict"))))
                            specl))
             (specl (if (fctn? declr)
                        (remove (lambda (node)
@@ -1140,7 +1140,6 @@
             ;; remove cruft like attributes and asms and initizers)
             (declr (and declr (sx-list (sx-tag declr) #f (sx-ref declr 1)))))
        (values specl declr)))))
-(export cleanup-udecl)
 
 ;; @deffn {Procecure} back-ref-extend! decl typename
 ;; @deffnx {Procecure} back-ref-getall decl typename
(END)

Matt Wette <mwette>
Group administrator
Thu 20 May 2021 11:07:48 PM UTC, comment #3: 

I believe this is now fixed in commit 1b2f7a2e9cec8ca26.
If you want to check let me know, otherwise I will release as 1.03.7

Matt Wette <mwette>
Group administrator
Thu 20 May 2021 01:38:42 PM UTC, comment #2: 

I've been working the union issue.  I will get to this next, soon.

Matt Wette <mwette>
Group administrator
Thu 20 May 2021 04:52:23 AM UTC, comment #1: 

Hi,

if there is any additional information I could provide, please let me know.

Thank you!

Ricardo

Ricardo Wurmus <rekado>
Thu 29 Apr 2021 06:03:46 AM UTC, original submission:  

Hi,

I'm using the ffi-helper in Guile-DRMAA to generate low-level bindings.  With version 1.03.0 the generated `drmaa-v1-ffi-symbol-tab` contains all #define'd constants from the header.

With version 1.03.5 and 1.03.6 that alist is empty.

It is possible that I'm just doing something stupid that accidentally worked in 1.03.0.  Here's the Makefile rule that I use to generate Scheme code from the FFI file:

https://git.elephly.net/?p=software/guile-drmaa.git;a=blob;f=Makefile.am;h=3a97b3ef26f9e5d26dcef16e18e23c15711d0a87;hb=HEAD#l33

  33 drmaa/v1/ffi.scm: drmaa/v1/ffi.ffi
  34         $(AM_V_GEN) GUILE_AUTO_COMPILE=0 $(top_builddir)/pre-inst-env $(GUILE_TOOLS) compile-ffi -I $(top_srcdir)/include -X -o "$@" "$<" && \
  35         $(SED) -e 's,(define drmaa-v1-ffi-llibs (list)),(define drmaa-v1-ffi-llibs (delay (list (dynamic-link (or (getenv "GUILE_DRMAA_LIBRARY") (error "GUILE_DRMAA_LIBRARY must be set!")))))),' \
  36         -e 's,drmaa-v1-ffi-llibs),(force drmaa-v1-ffi-llibs)),' -i $@

The reason why I'm using force and delay is that the library itself is not available at build time.  The DRMAA libray itself is provided by the different HPC scheduler implementations, so it is available only at runtime.

Here are the contents of the FFI file:

   (define-ffi-module (drmaa v1 ffi)
     #:include '("include/drmaa.h"))

Thank your for the FFI helper!

Ricardo

Ricardo Wurmus <rekado>

 

(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 (Posted a comment)
  • -email is unavailable- added by rekado (Submitted 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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-05-30 mwette StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2022-01-26 mwette StatusFixed Confirmed
        Open/ClosedClosed Open
    2021-05-31 mwette StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2021-05-21 mwette StatusNone Ready For Test
    2021-05-20 mwette Assigned toNone mwette

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code