diff --git a/cmdutils.h b/cmdutils.h
index 793a1e83c44565b7c1e1a22a3cd121867396994f..ca4f4c1e8c291d6e083cc4914109584454aa4474 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -373,7 +373,7 @@ FILE *get_preset_file(char *filename, size_t filename_size,
  * Do all the necessary cleanup and abort.
  * This function is implemented in the avtools, not cmdutils.
  */
-void exit_program(int ret);
+av_noreturn void exit_program(int ret);
 
 /**
  * Realloc array to hold new_size elements of elem_size.
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index 7a9b18b808ab7787698c7c8e1d5df9abcdf96546..292a0a1a88f095e80e33dcb2b3e3bd3102f6542f 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -113,4 +113,10 @@
 #    define av_printf_format(fmtpos, attrpos)
 #endif
 
+#if AV_GCC_VERSION_AT_LEAST(2,5)
+#    define av_noreturn __attribute__((noreturn))
+#else
+#    define av_noreturn
+#endif
+
 #endif /* AVUTIL_ATTRIBUTES_H */