From 6b3a8915f3c50f7220121fcb9202ec20144389c4 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 14 Nov 2014 10:47:43 +0100 Subject: add abort() to non-reached code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This cleans up a lot of false-positives in static analysis and also helps compilers to optimize code paths in general. (tagging the fatal stingstream operator as ‘noreturn’ is far less trivial) --- libs/ardour/utils.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libs/ardour/utils.cc') diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 9c0aea885b..6d6511bb9f 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -429,7 +429,7 @@ ARDOUR::string_to_edit_mode (string str) return Lock; } fatal << string_compose (_("programming error: unknown edit mode string \"%1\""), str) << endmsg; - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return Slide; } @@ -468,7 +468,7 @@ ARDOUR::string_to_sync_source (string str) } fatal << string_compose (_("programming error: unknown sync source string \"%1\""), str) << endmsg; - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return Engine; } @@ -577,7 +577,7 @@ ARDOUR::string_to_auto_state (std::string str) } fatal << string_compose (_("programming error: %1 %2"), "illegal AutoState string: ", str) << endmsg; - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return Touch; } @@ -601,7 +601,7 @@ ARDOUR::auto_state_to_string (AutoState as) } fatal << string_compose (_("programming error: %1 %2"), "illegal AutoState type: ", as) << endmsg; - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return ""; } @@ -615,7 +615,7 @@ ARDOUR::string_to_auto_style (std::string str) } fatal << string_compose (_("programming error: %1 %2"), "illegal AutoStyle string: ", str) << endmsg; - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return Trim; } @@ -634,7 +634,7 @@ ARDOUR::auto_style_to_string (AutoStyle as) } fatal << string_compose (_("programming error: %1 %2"), "illegal AutoStyle type: ", as) << endmsg; - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return ""; } @@ -669,7 +669,7 @@ ARDOUR::native_header_format_extension (HeaderFormat hf, const DataType& type) } fatal << string_compose (_("programming error: unknown native header format: %1"), hf); - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return ".wav"; } -- cgit v1.2.3