AmokHuginnsson / replxx

A readline and libedit replacement that supports UTF-8, syntax highlighting, hints and Windows and is BSD licensed.
Other
689 stars 107 forks source link

gcc compile warnings on Windows #81

Closed doug-moen closed 4 years ago

doug-moen commented 4 years ago

When I compile replxx on Windows using g++ in the MSYS2 environment, I get the following warning messages:

In file included from C:/msys64/curv/curv/repl.cc:34:
C:/msys64/curv/extern/replxx/include/replxx.hxx:250: warning: ignoring '#pragma warning ' [-Wunknown-pragmas]
  250 | #pragma warning(push)
      |
C:/msys64/curv/extern/replxx/include/replxx.hxx:251: warning: ignoring '#pragma warning ' [-Wunknown-pragmas]
  251 | #pragma warning(disable:4251)
      |
C:/msys64/curv/extern/replxx/include/replxx.hxx:255: warning: ignoring '#pragma warning ' [-Wunknown-pragmas]
  255 | #pragma warning(pop)
      |
C:/msys64/curv/extern/replxx/include/replxx.hxx:367: warning: ignoring '#pragma warning ' [-Wunknown-pragmas]
  367 | #pragma warning(push)
      |
C:/msys64/curv/extern/replxx/include/replxx.hxx:368: warning: ignoring '#pragma warning ' [-Wunknown-pragmas]
  368 | #pragma warning(disable:4251)
      |
C:/msys64/curv/extern/replxx/include/replxx.hxx:372: warning: ignoring '#pragma warning ' [-Wunknown-pragmas]
  372 | #pragma warning(pop)
      |

These pragmas are unknown to GCC, they are specific to MSVC++. The solution is to guard them with #ifdef _MSC_VER instead of #ifdef _WIN32.

AmokHuginnsson commented 4 years ago

Merged.