On Thu, Oct 03, 2019 at 01:11:31PM +0200, felix.winkelm...@bevuta.com wrote:
> This patch extends 21ff0d6affb35f7184a5e78f9d4beccc869b47b2 to
> type-names, inline procedures and constants, giving a warning when
> an identifier naming such an entity is exported.

Hi all,

Apparently this commit broke our own build!  It turns out that tweaks.scm,
which is included by support.scm (and others) defines inline versions of
procedures which are also exported as regular procedure bindings by the
module (chicken compiler support).

Attached is a patch which:

a) Checks the list of unexportable stuff _after_ checking if there's a
   regular or syntax identifier defined for that export inside the module.
b) Restores types to the list of things checked that cannot be exported.

This is not ideal, as it allows one to have conflicting definitions in
multiple "namespaces" (for example, define-external, define-inline and
regular define for the same identifier) but at least CHICKEN itself will
build again.

One alternative could be to keep the current code and drop tweaks.scm.
I don't know how much of an impact that will have on the performace, but
it might be worth considering.  OTOH, this trick we're using in core
might be used in other real world codebases as well...

Cheers,
Peter
From d014872716a97628c96cf50095237828d643b856 Mon Sep 17 00:00:00 2001
From: Peter Bex <pe...@more-magic.net>
Date: Thu, 10 Oct 2019 07:47:24 +0200
Subject: [PATCH] Check if there _is_ a value or syntax binding before warning
 and declaring it undefined

This unbreaks the build of CHICKEN itself, which "abuses" the
possibility of having both a procedure and a define-inline version of
the same procedure in tweaks.scm.
---
 core.scm    |  3 ++-
 modules.scm | 15 ++++++---------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/core.scm b/core.scm
index b3177501..b05a68b6 100644
--- a/core.scm
+++ b/core.scm
@@ -1043,7 +1043,8 @@
                                                      (lambda (id)
                                                        (and (not (assq id foreign-variables))
                                                             (not (hash-table-ref inline-table id))
-                                                            (not (hash-table-ref constant-table id))))))
+                                                            (not (hash-table-ref constant-table id))
+                                                            (not (##sys#get id '##compiler#type-abbreviation))))))
 						 (let ((il (or (assq name import-libraries) all-import-libraries)))
 						   (when il
 						     (emit-import-lib name il)
diff --git a/modules.scm b/modules.scm
index e9abd786..9bc8a0fa 100644
--- a/modules.scm
+++ b/modules.scm
@@ -470,11 +470,6 @@
 		    (let* ((h (car xl))
 			   (id (if (symbol? h) h (car h))))
 		      (cond ((assq id sexports) (loop (cdr xl)))
-                            ((not (check-export id))
-                             (set! missing #t)
-                             (##sys#warn "exported identifier does not refer to value or syntax binding"
-                                          id)
-                             (loop (cdr xl)))
                             (else 
                               (cons 
                                 (cons 
@@ -488,12 +483,14 @@
                                                  (cdr a)) 
                                                 ((not def)
                                                  (set! missing #t)
-                                                 (##sys#warn 
-                                                   (string-append 
+						 (##sys#warn
+                                                  (string-append
 					           "exported identifier of module `" 
 					           (symbol->string name)
-					           "' has not been defined")
-					           id)
+						   (if (check-export id)
+						       "' has not been defined"
+						       "' does not refer to value or syntax binding"))
+					          id)
                                                  #f)
                                                 (else (module-rename id name)))))))
                               (loop (cdr xl))))))))))
-- 
2.20.1

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to