As per cppreference.com it's a C11 function included by string.h. Isn't Allegro supposed to comply with C90 or C99? C99 is the new default compile language for MinGW.

http://en.cppreference.com/w/c/string/byte/strerror

errno_t is nowhere to be found in MinGW. strerror and _strerror are provided in string.h on lines 81 and 98. Per MinGW 5.3.0 with mingwrt 3.22.4 and win32api 3.18.2.

It's defnitiely a bug in cmake, but maybe it's a bug in MinGW as well. I'll send a post to the mingwusers mailing list and see what they say.

As per stackoverflow http://stackoverflow.com/questions/1464711/how-to-detect-if-errno-t-is-defined ,

Quote :

"Microsoft's |errno_t| is redundant. |errno| is defined by the ISO C standard to be a modifiable lvalue of type |int|. If your code needs to store |errno| values, then you should put them into an |int|."

All we need to do is duplicate a string returned by strerror and store it in userdata->errmsg. strerror_r and strerror_s don't seem necessary. But it needs to return the string too, without causing a memory leak.

Edgar


On 11/30/2016 10:45 PM, SiegeLord wrote:
We could replace the check with a compile test to be sure (see, e.g. the check for ALLEGRO_HAVE_PROCFS_ARGCV).

The way the check works is that it tries to find it at link time, but perhaps it's in a different header or needs some macro defined to be enabled.

If the second is true, we'll need a compile test to determine the macro anyway, so I think using a compile test is probably what's best here.

Alternatively, could this be yet another MinGW bug that you've uncovered?

-SL

On 11/30/2016 03:58 PM, Edgar Reynaldo wrote:
I recently updated cmake to the latest version (3.7.1) after finding out
that cmake is incorrectly detecting strerror_s in MinGW 5.3.0 when it
doesn't exist in MinGW.

errno_t and strerror_s are used in file_stdio.c on line 302 when
ALLEGRO_HAVE_STRERROR_S is defined. It is defined by a check for
"check_function_exists(strerror_s ALLEGRO_HAVE_STRERROR_S)" on line 486
of CMakeLists.txt. strerror_s and errno_t are nowhere to be found in
MinGW as indicated by a comment in file_stdio.c on line 289.

Not sure how to fix this, but currently Allegro fails to build on MinGW
because of the faulty detection by CMake.

Edgar



_______________________________________________
Allegro-developers mailing list
Allegro-developers@gna.org
https://mail.gna.org/listinfo/allegro-developers

_______________________________________________
Allegro-developers mailing list
Allegro-developers@gna.org
https://mail.gna.org/listinfo/allegro-developers

_______________________________________________
Allegro-developers mailing list
Allegro-developers@gna.org
https://mail.gna.org/listinfo/allegro-developers

Reply via email to