Menu

#2259 Win32 GCC LTO ODR violation warning for Message enum

Bug
closed-fixed
5
2021-06-24
2021-06-03
Zufu Liu
No

See Windows GCC LTO build logs at https://github.com/zufuliu/notepad2/runs/2729178653?check_suite_focus=true#step:5:200

../../scintilla/include/ScintillaMessages.h:16:12: warning: type 'Scintilla::Message' violates the C++ One Definition Rule [-Wodr]
   16 | enum class Message {
      |            ^
../../scintilla/include/ScintillaMessages.h:16:12: note: an enum with different value name is defined in another translation unit
   16 | enum class Message {
      |            ^
../../scintilla/include/ScintillaMessages.h:242:2: note: name 'FindTextW' differs from name 'FindText' defined in another translation unit
  242 |  FindText = 2150,
      |  ^
../../scintilla/include/ScintillaMessages.h:242:2: note: mismatching definition
  242 |  FindText = 2150,
      |  ^

This can be fixed by undef the win32 FindText macro before include Scintilla headers. Other compiler (MSVC, clang-cl, mingw clang) does not has the warning.

1 Attachments

Discussion

  • Neil Hodgson

    Neil Hodgson - 2021-06-03

    It appears it can also be avoided by including windows.h with WIN32_LEAN_AND_MEAN avoiding commdlg.h which contains FindText.

    #define WIN32_LEAN_AND_MEAN 1
    #include <windows.h>
    
     
    • Zufu Liu

      Zufu Liu - 2021-06-04

      Yes, define WIN32_LEAN_AND_MEAN fixed the warning.

       
  • Neil Hodgson

    Neil Hodgson - 2021-06-04
    • labels: --> scintilla, win32
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2021-06-04

    Committed fix as [8b4634].

    WIN32_LEAN_AND_MEAN can potentially avoid more issues.

     

    Related

    Commit: [8b4634]

  • Neil Hodgson

    Neil Hodgson - 2021-06-24
    • status: open-fixed --> closed-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2021-06-24

    Committed fix as [8b4634].

    WIN32_LEAN_AND_MEAN can potentially avoid more issues.

     

    Related

    Commit: [8b4634]


Log in to post a comment.

MongoDB Logo MongoDB