[llvm-commits] CVS: llvm/runtime/GCCLibraries/crtend/crtend.c
Chris Lattner
lattner at cs.uiuc.edu
Fri Dec 19 01:52:01 PST 2003
Changes in directory llvm/runtime/GCCLibraries/crtend:
crtend.c updated: 1.2 -> 1.3
---
Log message:
Add support for people calling main recursively
---
Diffs of the changes: (+7 -0)
Index: llvm/runtime/GCCLibraries/crtend/crtend.c
diff -u llvm/runtime/GCCLibraries/crtend/crtend.c:1.2 llvm/runtime/GCCLibraries/crtend/crtend.c:1.3
--- llvm/runtime/GCCLibraries/crtend/crtend.c:1.2 Wed Jun 25 23:20:38 2003
+++ llvm/runtime/GCCLibraries/crtend/crtend.c Fri Dec 19 01:51:46 2003
@@ -34,6 +34,13 @@
/* Loop over all of the constructor records, calling each function pointer. */
TorRec *R = __llvm_getGlobalCtors();
+ /* Recursively calling main is not legal C, but lots of people do it for
+ * testing stuff. We might as well work for them.
+ */
+ static _Bool Initialized = 0;
+ if (Initialized) return;
+ Initialized = 1;
+
/* Only register the global dtor handler if there is at least one global
* dtor!
*/
More information about the llvm-commits
mailing list