Menu

#2315 KeyMap.cxx and RunStyles.cxx missing includes

Bug
closed-fixed
scintilla (604)
5
2022-02-24
2022-02-07
Zufu Liu
No

Inspired by https://bugs.python.org/issue46670 when build with -Wundef there are two undefined macros:
see https://ci.appveyor.com/project/zufuliu/notepad2/build/job/ygqkgili6888du2j#L42

..\..\scintilla\src\KeyMap.cxx(55,5): warning :  'PLAT_GTK_MACOSX' is not defined, evaluates to 0 [-Wundef] [C:\projects\notepad2\build\VS2017\Notepad2.vcxproj]
..\..\scintilla\src\KeyMap.cxx(55,5): warning : #if PLAT_GTK_MACOSX [C:\projects\notepad2\build\VS2017\Notepad2.vcxproj]
..\..\scintilla\src\KeyMap.cxx(55,5): warning :     ^ [C:\projects\notepad2\build\VS2017\Notepad2.vcxproj]
..\..\scintilla\src\KeyMap.cxx(55,5): warning : 1 warning generated. [C:\projects\notepad2\build\VS2017\Notepad2.vcxproj]
..\..\scintilla\src\RunStyles.cxx(313,33): warning :  'PLAT_HAIKU' is not defined, evaluates to 0 [-Wundef] [C:\projects\notepad2\build\VS2017\Notepad2.vcxproj]
..\..\scintilla\src\RunStyles.cxx(313,33): warning : #if (PTRDIFF_MAX != INT_MAX) || PLAT_HAIKU [C:\projects\notepad2\build\VS2017\Notepad2.vcxproj]
..\..\scintilla\src\RunStyles.cxx(313,33): warning :                                 ^ [C:\projects\notepad2\build\VS2017\Notepad2.vcxproj]
..\..\scintilla\src\RunStyles.cxx(313,33): warning : 1 warning generated. [C:\projects\notepad2\build\VS2017\Notepad2.vcxproj]

Maybe Platform.h can be separated as two headers for macro and interface definitions.

Discussion

  • Neil Hodgson

    Neil Hodgson - 2022-02-07

    These are from [23f8d4].

    For KeyMap.cxx, it is using knowledge of the windowing system to choose paths so it is OK to #include "Platform.h" for now. It would be better if decisions about platform were made in the platform layer where GDK_WINDOWING_QUARTZ can be used and can be differentiated with GDK_WINDOWING_X11 (on macOS) if needed. There are really two paths: Mac and others and this could be a runtime choice. There is also a macOS keyboard mapping in cocoa/ScintillaCocoa.mm and there should be more sharing.

    For RunStyles.cxx, it is a compiler issue, not a windowing/graphics issue and could be detected directly by #if defined(__HAIKU__). Alternatively, a conditional template similar in meaning to if int != ptrdiff_t may be better as it matches the actual problem and may adapt to other situations.
    https://groups.google.com/g/scintilla-interest/c/xPXquJUIXo8/m/BLXBpTTgBwAJ

     

    Related

    Commit: [23f8d4]

  • Neil Hodgson

    Neil Hodgson - 2022-02-15
    • labels: --> scintilla
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2022-02-15

    Committed fix with [0d06f4].

     

    Related

    Commit: [0d06f4]

  • Neil Hodgson

    Neil Hodgson - 2022-02-24
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.