1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-12-26 16:55:45 +00:00

Fix build on OpenBSD

There are declaration conflicts between ctype.h and libcpuid_internal.h. Let's provide a workaround for it.
This commit is contained in:
The Tumultuous Unicorn Of Darkness 2024-07-27 17:39:48 +02:00
parent c6723aa914
commit 508225fe3f
No known key found for this signature in database
GPG key ID: 1E55EE2EFF18BC1A
9 changed files with 91 additions and 5 deletions

View file

@ -990,6 +990,7 @@ RECURSIVE = NO
# run.
EXCLUDE = @top_srcdir@/libcpuid/libcpuid_internal.h \
@top_srcdir@/libcpuid/libcpuid_ctype.h \
@top_srcdir@/libcpuid/libcpuid_util.h
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or

View file

@ -35,6 +35,7 @@ noinst_HEADERS = \
asm-bits.h \
centaur_code_t.h \
intel_code_t.h \
libcpuid_ctype.h \
libcpuid_internal.h \
libcpuid_util.h \
recog_amd.h \

81
libcpuid/libcpuid_ctype.h Normal file
View file

@ -0,0 +1,81 @@
/*
* Copyright 2024 Veselin Georgiev,
* anrieffNOSPAM @ mgail_DOT.com (convert to gmail)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __LIBCPUID_CTYPE_H__
#define __LIBCPUID_CTYPE_H__
/*
* This file contains ctype.h function declarations for OS where this header cannot be included
*/
#if defined(__OpenBSD__)
/* On OpenBSD, _common_bits_t/_intel_bits_t/_amd_bits_t from libcpuid_internal.h conflict with ctype.h */
int isalnum(int);
int isalpha(int);
int iscntrl(int);
int isdigit(int);
int isgraph(int);
int islower(int);
int isprint(int);
int ispunct(int);
int isspace(int);
int isupper(int);
int isxdigit(int);
int tolower(int);
int toupper(int);
# if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE > 200112 \
|| __XPG_VISIBLE > 600
int isblank(int);
# endif
# if __BSD_VISIBLE || __XPG_VISIBLE
int isascii(int);
int toascii(int);
int _tolower(int);
int _toupper(int);
# endif /* __BSD_VISIBLE || __XPG_VISIBLE */
# if __POSIX_VISIBLE >= 200809
int isalnum_l(int, locale_t);
int isalpha_l(int, locale_t);
int isblank_l(int, locale_t);
int iscntrl_l(int, locale_t);
int isdigit_l(int, locale_t);
int isgraph_l(int, locale_t);
int islower_l(int, locale_t);
int isprint_l(int, locale_t);
int ispunct_l(int, locale_t);
int isspace_l(int, locale_t);
int isupper_l(int, locale_t);
int isxdigit_l(int, locale_t);
int tolower_l(int, locale_t);
int toupper_l(int, locale_t);
# endif
#else
# include <ctype.h>
#endif
#endif /* __LIBCPUID_CTYPE_H__ */

View file

@ -28,11 +28,11 @@
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "libcpuid.h"
#include "libcpuid_ctype.h"
#include "libcpuid_util.h"
#include "libcpuid_internal.h"

View file

@ -202,6 +202,9 @@
<File
RelativePath=".\libcpuid_constants.h">
</File>
<File
RelativePath=".\libcpuid_ctype.h">
</File>
<File
RelativePath=".\libcpuid_internal.h">
</File>

View file

@ -26,8 +26,8 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "libcpuid.h"
#include "libcpuid_ctype.h"
#include "libcpuid_util.h"
#include "libcpuid_internal.h"
#include "recog_amd.h"

View file

@ -27,9 +27,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <inttypes.h>
#include "libcpuid.h"
#include "libcpuid_ctype.h"
#include "libcpuid_util.h"
#include "libcpuid_internal.h"
#include "recog_arm.h"

View file

@ -26,8 +26,8 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "libcpuid.h"
#include "libcpuid_ctype.h"
#include "libcpuid_util.h"
#include "libcpuid_internal.h"
#include "recog_centaur.h"

View file

@ -24,8 +24,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <string.h>
#include <ctype.h>
#include "libcpuid.h"
#include "libcpuid_ctype.h"
#include "libcpuid_util.h"
#include "libcpuid_internal.h"
#include "recog_intel.h"