From f91e68beb9582b5fb54f4b937e42cd3b6f192c9f Mon Sep 17 00:00:00 2001
From: "Tobias S. Josefowitz" <tobij@tobij.de>
Date: Wed, 10 Sep 2014 23:21:15 +0200
Subject: [PATCH] Revert "precompile: new nonstatic flag"

That sort of breaks with older precompiles...

This reverts commit f7f9f93cb2ea4d1ba6cd429eb111844b54a347d9.
---
 .../Tools.pmod/Standalone.pmod/precompile.pike      | 13 +++----------
 src/backend.cmod                                    |  6 ++----
 src/iterators.cmod                                  |  4 ++--
 src/modules/Gmp/mpf.cmod                            |  3 ++-
 src/modules/Gmp/mpq.cmod                            |  3 ++-
 5 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike b/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike
index 61578e3579..c41cdd15e9 100644
--- a/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike
+++ b/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike
@@ -141,7 +141,6 @@ string usage = #"[options] <from> > <to>
 
  Currently, the following attributes are understood:
    efun;          makes this function a global constant (no value)
-   nonstatic;     makes PIKECLASSes and PIKEFUNs that are not static
    flags;         ID_STATIC | ID_NOMASK etc.
    optflags;      OPT_TRY_OPTIMIZE | OPT_SIDE_EFFECT etc.
    optfunc;       Optimization function.
@@ -1308,7 +1307,6 @@ array recursive(mixed func, array data, mixed ... args)
 // where.
 constant valid_attributes = (<
   "efun",
-  "nonstatic",
   "flags",
   "optflags",
   "optfunc",
@@ -1876,9 +1874,8 @@ sprintf("        } else {\n"
 	    string define = make_unique_name("class", base, name, "defined");
 
 	    ret+=DEFINE(define);
-	    ret+=({sprintf("%sstruct program *%s=NULL;\n"
+	    ret+=({sprintf("DEFAULT_CMOD_STORAGE struct program *%s=NULL;\n"
 			   "static int %s_fun_num=-1;\n",
-                           attributes->nonstatic ? "" : "DEFAULT_CMOD_STORAGE ",
 			   program_var, program_var)});
 	    ret+=subclass->declarations;
 	    ret+=subclass->code;
@@ -2307,9 +2304,7 @@ static struct %s *%s_gdb_dummy_ptr;
 	  funcname = "NULL";
 	} else {
 	  ret+=({
-	    sprintf("%svoid %s(INT32 args) ",
-                    attributes->nonstatic ? "" : "DEFAULT_CMOD_STORAGE ",
-                    funcname),
+	    sprintf("DEFAULT_CMOD_STORAGE void %s(INT32 args) ",funcname),
 	    "{","\n",
 	  });
 
@@ -2665,9 +2660,7 @@ static struct %s *%s_gdb_dummy_ptr;
 	    ret+=IFDEF(tmp->define, ({
 	      sprintf("#define %s\n",define),
 	      sprintf("DEFAULT_CMOD_STORAGE ptrdiff_t %s = 0;\n", func_num),
-	      sprintf("%svoid %s(INT32 args) ",
-                      attributes->nonstatic ? "" : "DEFAULT_CMOD_STORAGE ",
-                      funcname),
+	      sprintf("DEFAULT_CMOD_STORAGE void %s(INT32 args) ",funcname),
 	      "{\n",
 	    })+out+({
 	      "}\n",
diff --git a/src/backend.cmod b/src/backend.cmod
index b0c1b870ee..6753309ca1 100644
--- a/src/backend.cmod
+++ b/src/backend.cmod
@@ -177,6 +177,8 @@ struct hash_ent
 
 
 
+#define DEFAULT_CMOD_STORAGE
+
 DECLARATIONS
 
 
@@ -273,7 +275,6 @@ struct Backend_struct *really_get_backend_for_fd(int fd)
  *!   main backend APIs.
  */
 PIKECLASS Backend
-nonstatic;
 {
   /* Provide a unique count to be able to tell backends apart with _sprintf. */
   static int unused_id = 0;
@@ -3187,7 +3188,6 @@ static void sb_copy_selectors(struct sb_active_selectors *to,
  *!   @[Backend]
  */
 PIKECLASS PollDeviceBackend
-nonstatic;
 {
   INHERIT Backend;
 
@@ -4437,7 +4437,6 @@ static void check_set_timer(struct timeval tmp)
  *!   @[Backend]
  */
 PIKECLASS PollBackend
-nonstatic;
 {
   INHERIT Backend;
 
@@ -5041,7 +5040,6 @@ nonstatic;
  *! Backend based on the classic @tt{select(2)@} system call from BSD.
  */
 PIKECLASS SelectBackend
-nonstatic;
 {
   INHERIT Backend;
 
diff --git a/src/iterators.cmod b/src/iterators.cmod
index 9fd65a2cc3..ef290dcb8f 100644
--- a/src/iterators.cmod
+++ b/src/iterators.cmod
@@ -29,6 +29,8 @@
 
 #define sp Pike_sp
 
+#define DEFAULT_CMOD_STORAGE
+
 DECLARATIONS
 
 /*! @class Iterator
@@ -1182,7 +1184,6 @@ PIKECLASS file_line_iterator
  *!   @endcode
  */
 PIKECLASS string_split_iterator
-nonstatic;
 {
   CVAR struct pike_string *buffer;
   CVAR struct pike_string *current;
@@ -1871,7 +1872,6 @@ nonstatic;
  */
 PIKEFUN object(Iterator) get_iterator(object|array|mapping|multiset|string data)
   efun;
-  nonstatic;
 {
   switch(TYPEOF(*data))
   {
diff --git a/src/modules/Gmp/mpf.cmod b/src/modules/Gmp/mpf.cmod
index cca840992e..005e14eeae 100644
--- a/src/modules/Gmp/mpf.cmod
+++ b/src/modules/Gmp/mpf.cmod
@@ -43,6 +43,8 @@
 #define sp Pike_sp
 #define fp Pike_fp
 
+#define DEFAULT_CMOD_STORAGE
+
 DECLARATIONS
 
 #define THISMPF (&(THIS->n))
@@ -106,7 +108,6 @@ DECLARATIONS
 
 /*  id PROG_GMP_MPF_ID; */
 PIKECLASS mpf
-nonstatic;
 {
   CVAR MP_FLT n;
 
diff --git a/src/modules/Gmp/mpq.cmod b/src/modules/Gmp/mpq.cmod
index c906e8fbbf..2bfc14309d 100644
--- a/src/modules/Gmp/mpq.cmod
+++ b/src/modules/Gmp/mpq.cmod
@@ -44,6 +44,8 @@
 #define sp Pike_sp
 #define fp Pike_fp
 
+#define DEFAULT_CMOD_STORAGE
+
 DECLARATIONS
 
 #define THISMPQ (&(THIS->n))
@@ -60,7 +62,6 @@ DECLARATIONS
 
 /*  id PROG_GMP_MPQ_ID; */
 PIKECLASS mpq
-nonstatic;
 {
   CVAR MP_RAT n;
 
-- 
GitLab