Fixed compilation error on MinGW due to how C++ attributes are handled

This commit is contained in:
Snaipe 2015-10-05 19:54:49 +02:00
parent c0e7486df3
commit 15f3af54fe
5 changed files with 46 additions and 14 deletions

View file

@ -24,8 +24,6 @@
#ifndef POSIX_COMPAT_H_
# define POSIX_COMPAT_H_
# include "config.h"
# if defined(_WIN32) && !defined(__CYGWIN__)
# define VANILLA_WIN32
# endif
@ -66,18 +64,6 @@
# define SIGPROF 27
# define CR_EXCEPTION_TIMEOUT 0xC0001042
# if HAVE_STRTOK_S
# define strtok_r strtok_s
# else
static CR_INLINE char *strtok_r(char *str, const char *delim, CR_UNUSED char **saveptr) {
return strtok(str, delim);
}
# endif
# ifdef _MSC_VER
# define strdup _strdup
# endif
# else
# include <sys/wait.h>
# endif

43
src/compat/strtok.h Normal file
View file

@ -0,0 +1,43 @@
/*
* The MIT License (MIT)
*
* Copyright © 2015 Franklin "Snaipe" Mathieu <http://snai.pe/>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef COMPAT_STRTOK_H_
# define COMPAT_STRTOK_H_
# include "config.h"
# ifdef VANILLA_WIN32
# if HAVE_STRTOK_S
# define strtok_r strtok_s
# else
static CR_INLINE char *strtok_r(char *str, const char *delim, CR_UNUSED char **saveptr) {
return strtok(str, delim);
}
# endif
# ifdef _MSC_VER
# define strdup _strdup
# endif
# endif
#endif /* !COMPAT_STRTOK_H_ */

View file

@ -31,6 +31,7 @@
#include "criterion/options.h"
#include "criterion/ordered-set.h"
#include "compat/posix.h"
#include "compat/strtok.h"
#include "compat/time.h"
#include "string/i18n.h"
#include "config.h"

View file

@ -30,6 +30,7 @@
#include "criterion/options.h"
#include "criterion/ordered-set.h"
#include "compat/posix.h"
#include "compat/strtok.h"
#include "compat/time.h"
#include "config.h"
#include "common.h"

View file

@ -30,6 +30,7 @@
#include "criterion/options.h"
#include "criterion/ordered-set.h"
#include "compat/posix.h"
#include "compat/strtok.h"
#include "compat/time.h"
#include "config.h"
#include "common.h"