On 10/06/2011 10:43 AM, Bruno Haible wrote: > Bernhard Voelker wrote: >> Alternatively, can't we use _exit() here? > > This would not change the problem: _exit() is, like exit(), declared > as nonreturning on glibc systems and not declared this way on some > other platforms.
Is this true? exit is declared as a nonreturning built-in by GCC (devel/gcc/gcc/builtins.def): DEF_LIB_BUILTIN (BUILT_IN_EXIT, "exit", BT_FN_VOID_INT, ATTR_NORETURN_NOTHROW_LIST) It has been so since 2002 (r55276) for C++, and "forever" for C. The code that was first checked into RCS already had this: /* Declare these functions volatile to avoid spurious "control drops through" warnings. */ /* Don't specify the argument types, to avoid errors from certain code which isn't valid in ANSI but which exists. */ temp = builtin_function ("abort", build_function_type (void_type_node, 0), NOT_BUILT_IN, 0); TREE_THIS_VOLATILE (temp) = 1; TREE_SIDE_EFFECTS (temp) = 1; #if 0 /* Suppress error if redefined as a non-function. */ DECL_BUILT_IN_NONANSI (temp) = 1; #endif exit_type = build_function_type (void_type_node, 0); temp = builtin_function ("exit", exit_type, NOT_BUILT_IN, 0); TREE_THIS_VOLATILE (temp) = 1; TREE_SIDE_EFFECTS (temp) = 1; #if 0 /* Suppress error if redefined as a non-function. */ DECL_BUILT_IN_NONANSI (temp) = 1; #endif For non-GCC compilers I don't think we care about warnings, do we? Paolo