#4762: fix switch statements to avoid compiler warnings
-------------------------------------------------+-------------------------
 Reporter:  Forgon                               |             Owner:
     Type:  patch (an actual patch, not a        |            Status:  new
  request for one)                               |         Milestone:
 Priority:  normal                               |  unspecified
Component:  other                                |           Version:
 Keywords:                                       |  git/master
 Blocking:                                       |        Blocked By:
                                                 |  Operating System:  All
                                                 |  /Non-Specific
-------------------------------------------------+-------------------------
 Compiling the most recent version of the master branch at commit
 9942d7d1475ba704b0c3148ee210e97f534481d8 fails with the following
 warnings:

 {{{
 piestate.cpp: In function ‘SHADER_VERSION
 getMaximumShaderVersionForCurrentGLContext()’:
 piestate.cpp:262:13: warning: this statement may fall through [-Wimplicit-
 fallthrough=]
      version = VERSION_130;
      ~~~~~~~~^~~~~~~~~~~~~
 piestate.cpp:263:4: note: here
     case 1: // 3.1 => 1.40
     ^~~~
 piestate.cpp:264:13: warning: this statement may fall through [-Wimplicit-
 fallthrough=]
      version = VERSION_140;
      ~~~~~~~~^~~~~~~~~~~~~
 piestate.cpp:265:4: note: here
     case 2: // 3.2 => 1.50
     ^~~~
 piestate.cpp:266:13: warning: this statement may fall through [-Wimplicit-
 fallthrough=]
      version = VERSION_150_CORE;
      ~~~~~~~~^~~~~~~~~~~~~~~~~~
 piestate.cpp:267:4: note: here
     case 3: // 3.3 => 3.30
     ^~~~
 piestate.cpp:268:13: warning: this statement may fall through [-Wimplicit-
 fallthrough=]
      version = VERSION_330_CORE;
      ~~~~~~~~^~~~~~~~~~~~~~~~~~
 piestate.cpp:269:4: note: here
     default:
     ^~~~~~~
 piestate.cpp:279:13: warning: this statement may fall through [-Wimplicit-
 fallthrough=]
      version = VERSION_400_CORE;
      ~~~~~~~~^~~~~~~~~~~~~~~~~~
 piestate.cpp:280:4: note: here
     case 1: // 4.1 => 4.10
     ^~~~
 piestate.cpp:281:13: warning: this statement may fall through [-Wimplicit-
 fallthrough=]
      version = VERSION_410_CORE;
      ~~~~~~~~^~~~~~~~~~~~~~~~~~
 piestate.cpp:282:4: note: here
     default:
     ^~~~~~~
 piestate.cpp: In function ‘const char*
 shaderVersionString(SHADER_VERSION)’:
 piestate.cpp:319:1: warning: control reaches end of non-void function
 [-Wreturn-type]
  }
  ^
 }}}

 The problem had recently been introduced in

 `
 commit 37af8da9eb69ec042960324a24be03944c69d9ca
 Author: past-due <[email protected]>
 Date:   Mon Mar 12 00:35:33 2018 -0400

     Add initial support for OpenGL 3.2 Core Profile

     - Shaders that support (the current) GLSL version 120 through (new)
 version 150 core.
     - The appropriate #version directive is now applied to the built-in
 shaders at run-time (before compilation) based on the current OpenGL
 context.
     - A new #define (WZ_USE_OPENGL_3_2_CORE_PROFILE) which enables using
 an OpenGL 3.2 Core Profile context (and all other required OpenGL / SDL
 setup).
 '

 The attached patch fixes the problem.

--
Ticket URL: <http://developer.wz2100.net/ticket/4762>
Warzone 2100 Trac <http://developer.wz2100.net/>
The Warzone 2100 Project
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Warzone2100-project mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/warzone2100-project

Reply via email to