Skip to content
Snippets Groups Projects
Commit 86dd6d83 authored by Chris Lattner's avatar Chris Lattner
Browse files

Add support for people calling main recursively

llvm-svn: 10535
parent 547192d6
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,13 @@ void __main(void) {
/* 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!
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment