[svn:parrot] r47541 - in trunk: include/parrot src src/pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Thu Jun 10 18:38:14 UTC 2010


Author: NotFound
Date: Thu Jun 10 18:38:14 2010
New Revision: 47541
URL: https://trac.parrot.org/parrot/changeset/47541

Log:
add the function Parrot_warn_deprecated and use it in a few places

Modified:
   trunk/include/parrot/warnings.h
   trunk/src/library.c
   trunk/src/pmc/parrotinterpreter.pmc
   trunk/src/warnings.c

Modified: trunk/include/parrot/warnings.h
==============================================================================
--- trunk/include/parrot/warnings.h	Thu Jun 10 16:58:17 2010	(r47540)
+++ trunk/include/parrot/warnings.h	Thu Jun 10 18:38:14 2010	(r47541)
@@ -61,12 +61,20 @@
         __attribute__nonnull__(3);
 
 PARROT_EXPORT
+void Parrot_warn_deprecated(PARROT_INTERP, ARGIN(const char *message))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+PARROT_EXPORT
 void print_pbc_location(PARROT_INTERP)
         __attribute__nonnull__(1);
 
 #define ASSERT_ARGS_Parrot_warn __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(message))
+#define ASSERT_ARGS_Parrot_warn_deprecated __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(message))
 #define ASSERT_ARGS_print_pbc_location __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */

Modified: trunk/src/library.c
==============================================================================
--- trunk/src/library.c	Thu Jun 10 16:58:17 2010	(r47540)
+++ trunk/src/library.c	Thu Jun 10 18:38:14 2010	(r47541)
@@ -809,6 +809,7 @@
     ASSERT_ARGS(Parrot_get_runtime_prefix)
     char * const env = Parrot_getenv(interp, CONST_STRING(interp, "PARROT_RUNTIME"));
 
+    Parrot_warn_deprecated(interp, "Parrot_get_runtime_prefix is deprecated TT #1191");
     if (env)
         return env;
     else {

Modified: trunk/src/pmc/parrotinterpreter.pmc
==============================================================================
--- trunk/src/pmc/parrotinterpreter.pmc	Thu Jun 10 16:58:17 2010	(r47540)
+++ trunk/src/pmc/parrotinterpreter.pmc	Thu Jun 10 18:38:14 2010	(r47541)
@@ -844,6 +844,7 @@
 
     METHOD stdhandle(INTVAL fileno, PMC *newhandle :optional) {
         PMC * const handle = Parrot_io_stdhandle(INTERP, fileno, newhandle);
+        Parrot_warn_deprecated(INTERP, "stdhandle method is experimental");
         RETURN(PMC *handle);
     }
 

Modified: trunk/src/warnings.c
==============================================================================
--- trunk/src/warnings.c	Thu Jun 10 16:58:17 2010	(r47540)
+++ trunk/src/warnings.c	Thu Jun 10 18:38:14 2010	(r47541)
@@ -124,6 +124,28 @@
 
 /*
 
+=item C<void Parrot_warn_deprecated(PARROT_INTERP, const char *message)>
+
+Warn about use of a deprecated feature
+
+C<message> is a C string.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_warn_deprecated(PARROT_INTERP, ARGIN(const char *message))
+{
+    if (PARROT_WARNINGS_test(interp, PARROT_WARNINGS_DEPRECATED_FLAG)) {
+        STRING *msg = Parrot_sprintf_c(interp, "WARNING: %s\n", message);
+        print_warning(interp, msg);
+    }
+}
+
+/*
+
 =back
 
 =head1 SEE ALSO


More information about the parrot-commits mailing list