Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MinGW does support CODECVT #37

Closed
eXpl0it3r opened this issue Oct 3, 2016 · 2 comments
Closed

MinGW does support CODECVT #37

eXpl0it3r opened this issue Oct 3, 2016 · 2 comments
Labels

Comments

@eXpl0it3r
Copy link
Contributor

As mentioned in my comment the following logic makes it that AVOID_CPP11_CODECVT is always set when using a MinGW compiler, even though MinGW also supports codecvt (probably starting from GCC 5.1 upwards as well).

#if ((defined(__GNUC__) && !(__GNUC__ >= 5 && __GNUC_MINOR__ > 1)) \
     || defined(__MINGW32__)) \
    && !defined(__APPLE__)
 #   define AVOID_CPP11_CODECVT
 #endif

The easy fix could be to just remove the __MINGW32__ check since the GNUC check should work for MinGW as well.

Furthermore MinGW doesn't seem to support the alloca.h header, so when someone would be using an older compiler the else branch would fail to compile.

// Note: <codecvt> is C++11. It exists in libc++ (LLVM) but is patchy in libstdc++ pre-GCC 5
#ifndef AVOID_CPP11_CODECVT
#   include <codecvt>      // Narrow/widen - C++11
#else
#   include <iconv.h>
#   include <alloca.h>
#endif

One fix I saw is to use malloc.h for Windows.

Relevant file: https://github.com/billyquith/GWork/blob/gwork/source/gwork/source/Utility.cpp

On a personal note: I find the double "negation" a bit confusing. Why define a Marco called "AVOID_X" and the check whether it's NOT defined? But that's maybe just me. 😉

@billyquith
Copy link
Owner

On a personal note: I find the double "negation" a bit confusing. Why define a Marco called "AVOID_X" and the check whether it's NOT defined? But that's maybe just me.

I suppose it could be a value and inverted. You are free submit a patch. ;)

@billyquith billyquith added the bug label Oct 3, 2016
billyquith added a commit that referenced this issue Oct 3, 2016
- MinGW is missing alloca.h
- Fix for issue #37.
@billyquith
Copy link
Owner

Compile bugs should be fixed. If you want to make the define a value and test for #if then be my guest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants