filipwasil / fillwave

Multiplatform C++14 graphics engine
https://filipwasildev.bitbucket.io/
MIT License
23 stars 6 forks source link

Support for new gcc 6 flags #96

Closed KeramKeram closed 7 years ago

KeramKeram commented 7 years ago

I update to fedora 24 and now I have gcc 6.2 but in this version we have something like: " -Wmisleading-indentation

A new warning -Wmisleading-indentation was added to -Wall, warning about places where the indentation of the code might mislead a human reader about the control flow: " Turn off this or do changes in code? (many of them i required I think we should turn off this).

For current code and flags I have error during building.

KeramKeram commented 7 years ago

For test I turned off this flag, now I have shift-negative-value... Migrate to gcc 6.x it will take some time.

KeramKeram commented 7 years ago

I uploaded two small changes required for fedora 24 but changes in flags I have only on my local branch.

KeramKeram commented 7 years ago

gcc 6 is not only in fedora but in ubuntu above version 16.04. I will today push "patch", he will turn off this two new flags but remember, you need still investigate this.

KeramKeram commented 7 years ago

Things to do:

  1. In cmake/compiler.cmake we have if (GCC_VERSION VERSION_GREATER 6.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-shift-negative-value") endif() In this place I'm checking if gcc is greater than 6.0 and I'm turning of two flags.
  2. Check in google what is flag misleading-indentation for gcc.
  3. Remove flag(simply delete line) and compile, check errors. In my opinion this flag should be off because indentation is our businesses not gcc, but check this. Write here conclusions.
  4. Check in google what is flag shift-negative-value for gcc.
  5. Remove flag(simply delete line) and compile, check errors. It should be one error try fix this or if it is some kind of false alarm leave the flag off. Write here conclusions.

You can always ask here or on skype.

mamilo commented 7 years ago

misleading-indentation - check that after for() or if()(or other like that without braces) not exist 2 expression in one line, for example: for() expression1;expression2; //this reports error

for() expression1; expression2; //this don't reports error


shift-negative-value - check that shifted value is nagative, for example: (-1 << 5); // this reports error (1 << 5); // ok


If we want to use this flags we would have to change external file(ext/stb/stb_image.h). So we are forced to use: if (GCC_VERSION VERSION_GREATER 6.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-shift-negative-value") endif()

KeramKeram commented 7 years ago

It should be able by add_compile_options of cmake but I'm not sure if we should, @filipwasil ?

filipwasil commented 7 years ago

agree