[gtkmm/wip/dboles/make_managed-4: 1/2] demo/demowindow: Use C++17 [[fallthrough]] attrib.
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/wip/dboles/make_managed-4: 1/2] demo/demowindow: Use C++17 [[fallthrough]] attrib.
- Date: Fri, 12 Oct 2018 20:22:19 +0000 (UTC)
commit 13d39e93ea2d27045a6bf520949c262115f05c23
Author: Daniel Boles <dboles src gmail com>
Date: Fri Oct 12 21:18:11 2018 +0100
demo/demowindow: Use C++17 [[fallthrough]] attrib.
Flip the if/else case so that the /* Fall through */ comment comes
before the next case label, which would suppress a warning from
-Wimplicit-fallthrough and looks clearer anyway - and then replace said
comment with the standard C++17 [[fallthrough]] attribute intended to
assuage compiler diagnostics in cases like this, as we use C++17 now.
demos/gtk-demo/demowindow.cc | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
---
diff --git a/demos/gtk-demo/demowindow.cc b/demos/gtk-demo/demowindow.cc
index d7e99ae0..809f0e65 100644
--- a/demos/gtk-demo/demowindow.cc
+++ b/demos/gtk-demo/demowindow.cc
@@ -361,20 +361,12 @@ void DemoWindow::load_file(const std::string& filename)
while (isspace (*p))
p++;
- if (*p)
- {
- p = lines[i];
- state++;
- /* Fall through */
- // TODO: Replace with [[fallthrough]] annotation (to case 3)
- // when we ue C++17.
- /* Reading program body */
- start = refBufferSource->insert(start, p);
- start = refBufferSource->insert(start, "\n");
+ if (!*p)
break;
- }
- else
- break;
+
+ p = lines[i];
+ state++;
+ [[fallthrough]];
case 3:
/* Reading program body */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]