Bug #84841 System header warnings should be suppressed properly
Submitted: 6 Feb 2017 14:07 Modified: 12 Jan 2018 15:03
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any
Tags: compilation warnings, Contribution

[6 Feb 2017 14:07] Laurynas Biveinis
Description:
5.7.17 added the following:

# Boost source has misleading indentation
MY_CHECK_CXX_COMPILER_FLAG("-Wmisleading-indentation"
                           HAVE_MISLEADING_INDENTATION)
IF(HAVE_MISLEADING_INDENTATION)
  ADD_COMPILE_FLAGS(
    geometry_rtree.cc
    item_geofunc.cc
    item_geofunc_buffer.cc
    item_geofunc_internal.cc
    item_geofunc_relchecks.cc
    item_geofunc_relchecks_bgwrap.cc
    item_geofunc_setops.cc    
    COMPILE_FLAGS "-Wno-misleading-indentation")
ENDIF()

For the listed files, this disables -Wmisleading-indentation in Boost successfully, but now this warning is suppressed for the MySQL source code itself, where it would be preferable to have this diagnostics enabled. GCC and flag-compatible compilers and CMake provide means to handle exactly this situation:
- For GCC, system include paths should be specified through -isystem option and not -I. Any files included through -isystem will have their warnings suppressed without having to turn them off for the source files themselves: https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html
- For CMake, INCLUDE_DIRECTORIES command has SYSTEM option - which results in -isystem used for GCC: https://cmake.org/cmake/help/v3.0/command/include_directories.html

How to repeat:
See above

Suggested fix:
Replace -I with -isystem where applicable, and add SYSTEM to INCLUDE_DIRECTORIES.
[6 Feb 2017 16:18] Laurynas Biveinis
Bug 84841 fix for 5.7.17

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bug84841-5.7.patch (application/octet-stream, text), 33.44 KiB.

[7 Feb 2017 5:54] MySQL Verification Team
Hello Laurynas,

Thank you for the report and contribution.

Thanks,
Umesh
[12 Jan 2018 15:03] Paul DuBois
Posted by developer:
 
Fixed in 9.0.0.

Code cleanup. No changelog entry needed.
[13 Feb 2018 2:14] Paul DuBois
Posted by developer:
 
Fixed in 8.0.5, not 9.0.0.