lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue 2758. ly_module_lookup caused deprecation warnings with Guile V2.0


From: ianhulin44
Subject: Issue 2758. ly_module_lookup caused deprecation warnings with Guile V2.06. (issue 6458159)
Date: Sun, 19 Aug 2012 22:31:46 +0000

Reviewers: ,

Message:
Cleaned up garbage in Subject and Description Fields.


Description:
Issue 2758. ly_module_lookup caused deprecation warnings with Guile
V2.06. The V2.17.0 definition of ly_module_lookup in module-scheme.cc
uses two functions, scm_sym2var and scm_module_lookup_closure, which
issue deprecation warnings in Guile V2.06.  A call to the new Guile API
function, scm_module_variable, provides the functionality for both
deprecated routines, but has not been back-ported to Guile V1.8.

This patch adds a conditionally-compiled shim function definition for
scm_module_variable when running with a Guile version < V2.0,
and changes ly_module_lookup to call scm_module_variable.

Please review this at http://codereview.appspot.com/6458159/

Affected files:
  M lily/module-scheme.cc


Index: lily/module-scheme.cc
diff --git a/lily/module-scheme.cc b/lily/module-scheme.cc
index 4fc43ca32b8c8f846d5373673615ae23a7a9eca8..d57e1928f4c93e4f2a8ccc223190654f33c438f3 100644
--- a/lily/module-scheme.cc
+++ b/lily/module-scheme.cc
@@ -17,8 +17,7 @@
   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */

-#include "ly-module.hh"
-
+#include "ly-module.hh" // pulls lily-guile.hh and guile-compatibility.hh
 #include "warn.hh"
 #include "main.hh"
 #include "std-string.hh"
@@ -52,14 +51,29 @@ LY_DEFINE (ly_module_copy, "ly:module-copy",
   return SCM_UNSPECIFIED;
 }

+
+#if defined (SCM_MAJOR_VERSION) && (SCM_MAJOR_VERSION < 2)
+
+SCM
+scm_module_variable (SCM module, SCM sym)
+{
+  return scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
+}
+
+#endif
+
+
 /* Lookup SYM, but don't give error when it is not defined.  */
 SCM
 ly_module_lookup (SCM module, SCM sym)
 {
 #define FUNC_NAME __FUNCTION__
   SCM_VALIDATE_MODULE (1, module);
-
-  return scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
+  /* For Guile 1.n, we use a shim declared above,
+     for Guile 2 and later versions scm_module_variable is
+     included in the Guile API.
+  */
+  return scm_module_variable (module, sym);
 #undef FUNC_NAME
 }






reply via email to

[Prev in Thread] Current Thread [Next in Thread]