Armin Rigo avatar Armin Rigo committed bb1e13c

Make the __thread in these files only appear in stm mode.

Comments (0)

Files changed (2)


 #include "src/profiling.h"
 #include "src/debug_print.h"
-__thread long pypy_have_debug_prints = -1;
+__thread_if_stm long pypy_have_debug_prints = -1;
 FILE *pypy_debug_file = NULL;   /* XXX make it thread-local too? */
 static unsigned char debug_ready = 0;
 static unsigned char debug_profile = 0;
-__thread char debug_start_colors_1[32];
-__thread char debug_start_colors_2[28];
-__thread char pypy_debug_threadid[16];
+__thread_if_stm static char debug_start_colors_1[32];
+__thread_if_stm static char debug_start_colors_2[28];
+__thread_if_stm char pypy_debug_threadid[16] = {0};
 static char *debug_stop_colors = "";
 static char *debug_prefix = NULL;
 static char *debug_filename = NULL;
         /* not a tty output: no colors */
         sprintf(debug_start_colors_1, "%d# ", (int)counter);
         sprintf(debug_start_colors_2, "%d# ", (int)counter);
+#ifdef RPY_STM
         sprintf(pypy_debug_threadid, "%d#", (int)counter);
     else {
         /* tty output */
                 color, (int)counter);
         sprintf(debug_start_colors_2, "\033[%dm%d# ",
                 color, (int)counter);
+#ifdef RPY_STM
         sprintf(pypy_debug_threadid, "\033[%dm%d#\033[0m",
                 color, (int)counter);


 long pypy_debug_offset(void);
 void pypy_debug_forked(long original_offset);
-extern __thread long pypy_have_debug_prints;
-extern __thread char pypy_debug_threadid[];
+#ifdef RPY_STM
+#define __thread_if_stm  __thread
+#define __thread_if_stm  /* nothing */
+extern __thread_if_stm long pypy_have_debug_prints;
+extern __thread_if_stm char pypy_debug_threadid[];
 extern FILE *pypy_debug_file;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.