backtrace: Only use __builtin_frame_address if GNU C is in use.
authorBen Pfaff <blp@nicira.com>
Thu, 16 Dec 2010 19:04:14 +0000 (11:04 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 23 Dec 2010 18:44:36 +0000 (10:44 -0800)
This eliminates one small GNU C dependency.

lib/backtrace.c

index 282f6b86828b0ba79b393730b5d856ce37e13847..91549db347812b516e2eb4fb27b93c54349deb62 100644 (file)
@@ -83,6 +83,7 @@ in_stack(void *p)
 void
 backtrace_capture(struct backtrace *backtrace)
 {
+#ifdef __GNUC__
     void **frame;
     size_t n;
 
@@ -95,4 +96,7 @@ backtrace_capture(struct backtrace *backtrace)
         backtrace->frames[n++] = (uintptr_t) frame[1];
     }
     backtrace->n_frames = n;
+#else
+    backtrace->n_frames = 0;
+#endif
 }