#define UNUSED_PARAM __attribute__ ((__unused__))
#define NORETURN __attribute__ ((__noreturn__))
+
+#if __GNUC_PREREQ(4,5)
+# define bb_unreachable(altcode) __builtin_unreachable()
+#else
+# define bb_unreachable(altcode) altcode
+#endif
+
/* "The malloc attribute is used to tell the compiler that a function
* may be treated as if any non-NULL pointer it returns cannot alias
* any other pointer valid when the function returns. This will often
#define EV_TESTED 02 /* exit status is checked; ignore -e flag */
static int evaltree(union node *, int);
+/* An evaltree() which is known to never return.
+ * Used to use an alias:
+ * static int evaltreenr(union node *, int) __attribute__((alias("evaltree"),__noreturn__));
+ * but clang was reported to "transfer" noreturn-ness to evaltree() as well.
+ */
+static ALWAYS_INLINE NORETURN void
+evaltreenr(union node *n, int flags)
+{
+ evaltree(n, flags);
+ bb_unreachable(abort());
+ /* NOTREACHED */
+}
+
static void FAST_FUNC
evalbackcmd(union node *n, struct backcmd *result)
{
*/
eflag = 0;
ifsfree();
- evaltree(n, EV_EXIT); /* actually evaltreenr... */
+ evaltreenr(n, EV_EXIT);
/* NOTREACHED */
}
/* parent */
return exitstatus;
}
-#if !defined(__alpha__) || (defined(__GNUC__) && __GNUC__ >= 3)
-static
-#endif
-int evaltreenr(union node *, int) __attribute__ ((alias("evaltree"),__noreturn__));
-
static int
skiploop(void)
{