Update to libpciaccess 0.13.1

This commit is contained in:
matthieu 2012-04-09 18:50:44 +00:00
parent 0bc99fee60
commit 39a8975b54
15 changed files with 4079 additions and 2435 deletions

View File

@ -1028,7 +1028,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what
# version you require.
m4_defun([XORG_MACROS_VERSION],[
m4_define([vers_have], [1.16.1])
m4_define([vers_have], [1.16.2])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,,
@ -2047,6 +2047,39 @@ AC_MSG_CHECKING([whether to build unit test cases])
AC_MSG_RESULT([$enable_unit_tests])
]) # XORG_ENABLE_UNIT_TESTS
# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto)
# ------------------------------------------------------
# Minimum version: 1.17.0
#
# This macro enables a builder to enable/disable integration testing
# It makes no assumption about the test cases' implementation
# Test cases may or may not use Automake "Support for test suites"
#
# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support
# usually requires less dependencies and may be built and run under less
# stringent environments than integration tests.
#
# Interface to module:
# ENABLE_INTEGRATION_TESTS: used in makefiles to conditionally build tests
# enable_integration_tests: used in configure.ac for additional configuration
# --enable-integration-tests: 'yes' user instructs the module to build tests
# 'no' user instructs the module not to build tests
# parm1: specify the default value, yes or no.
#
AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[
AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
m4_define([_defopt], m4_default([$1], [auto]))
AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests],
[Enable building integration test cases (default: ]_defopt[)]),
[enable_integration_tests=$enableval],
[enable_integration_tests=]_defopt)
m4_undefine([_defopt])
AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS],
[test "x$enable_integration_tests" != xno])
AC_MSG_CHECKING([whether to build unit test cases])
AC_MSG_RESULT([$enable_integration_tests])
]) # XORG_ENABLE_INTEGRATION_TESTS
# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT])
# ----------------------------------------
# Minimum version: 1.13.0
@ -2057,6 +2090,10 @@ AC_MSG_RESULT([$enable_unit_tests])
# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing.
# Otherwise the value of $enable_unit_tests is blank.
#
# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit
# test support usually requires less dependencies and may be built and run under
# less stringent environments than integration tests.
#
# Interface to module:
# HAVE_GLIB: used in makefiles to conditionally build targets
# with_glib: used in configure.ac to know if GLib has been found
@ -2415,12 +2452,20 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
#
# Checks for various brands of compilers and sets flags as appropriate:
# GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
# GNU g++ - relies on AC_PROG_CXX to set GXX to "yes"
# clang compiler - sets CLANGCC to "yes"
# Intel compiler - sets INTELCC to "yes"
# Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
#
AC_DEFUN([XORG_COMPILER_BRAND], [
AC_REQUIRE([AC_PROG_CC_C99])
AC_LANG_CASE(
[C], [
AC_REQUIRE([AC_PROG_CC_C99])
],
[C++], [
AC_REQUIRE([AC_PROG_CXX])
]
)
AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
@ -2440,54 +2485,77 @@ AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
# -Werror=unused-command-line-argument
#
AC_DEFUN([XORG_TESTSET_CFLAG], [
AC_REQUIRE([AC_PROG_CC_C99])
m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])])
xorg_testset_save_CFLAGS="$CFLAGS"
AC_LANG_COMPILER_REQUIRE
if test "x$xorg_testset_unknown_warning_option" = "x" ; then
CFLAGS="$CFLAGS -Werror=unknown-warning-option"
AC_MSG_CHECKING([if $CC supports -Werror=unknown-warning-option])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
[xorg_testset_unknown_warning_option=yes],
[xorg_testset_unknown_warning_option=no])
AC_MSG_RESULT([$xorg_testset_unknown_warning_option])
CFLAGS="$xorg_testset_save_CFLAGS"
AC_LANG_CASE(
[C], [
AC_REQUIRE([AC_PROG_CC_C99])
define([PREFIX], [C])
define([CACHE_PREFIX], [cc])
define([COMPILER], [$CC])
],
[C++], [
define([PREFIX], [CXX])
define([CACHE_PREFIX], [cxx])
define([COMPILER], [$CXX])
]
)
[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]"
if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option],
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option],
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes],
[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no]))
[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option]
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
fi
if test "x$xorg_testset_unused_command_line_argument" = "x" ; then
if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
CFLAGS="$CFLAGS -Werror=unknown-warning-option"
if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then
if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
fi
CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
AC_MSG_CHECKING([if $CC supports -Werror=unused-command-line-argument])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
[xorg_testset_unused_command_line_argument=yes],
[xorg_testset_unused_command_line_argument=no])
AC_MSG_RESULT([$xorg_testset_unused_command_line_argument])
CFLAGS="$xorg_testset_save_CFLAGS"
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument],
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument],
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes],
[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no]))
[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument]
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
fi
found="no"
m4_foreach([flag], m4_cdr($@), [
if test $found = "no" ; then
if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
CFLAGS="$CFLAGS -Werror=unknown-warning-option"
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
fi
if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
fi
CFLAGS="$CFLAGS ]flag["
PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
AC_MSG_CHECKING([if $CC supports ]flag[])
AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
[supported=yes], [supported=no])
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
AC_CACHE_VAL($cacheid,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
[eval $cacheid=yes],
[eval $cacheid=no])])
PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]"
eval supported=\$$cacheid
AC_MSG_RESULT([$supported])
CFLAGS="$xorg_testset_save_CFLAGS"
if test "$supported" = "yes" ; then
$1="$$1 ]flag["
found="yes"
@ -2500,13 +2568,13 @@ m4_foreach([flag], m4_cdr($@), [
# ---------------
# Minimum version: 1.16.0
#
# Defines BASE_CFLAGS to contain a set of command line arguments supported
# by the selected compiler which do NOT alter the generated code. These
# arguments will cause the compiler to print various warnings during
# compilation AND turn a conservative set of warnings into errors.
# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line
# arguments supported by the selected compiler which do NOT alter the generated
# code. These arguments will cause the compiler to print various warnings
# during compilation AND turn a conservative set of warnings into errors.
#
# The set of flags supported by BASE_CFLAGS will grow in future
# versions of util-macros as options are added to new compilers.
# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in
# future versions of util-macros as options are added to new compilers.
#
AC_DEFUN([XORG_COMPILER_FLAGS], [
AC_REQUIRE([XORG_COMPILER_BRAND])
@ -2517,76 +2585,89 @@ AC_ARG_ENABLE(selective-werror,
[SELECTIVE_WERROR=$enableval],
[SELECTIVE_WERROR=yes])
AC_LANG_CASE(
[C], [
define([PREFIX], [C])
],
[C++], [
define([PREFIX], [CXX])
]
)
# -v is too short to test reliably with XORG_TESTSET_CFLAG
if test "x$SUNCC" = "xyes"; then
BASE_CFLAGS="-v"
[BASE_]PREFIX[FLAGS]="-v"
else
BASE_CFLAGS=""
[BASE_]PREFIX[FLAGS]=""
fi
# This chunk of warnings were those that existed in the legacy CWARNFLAGS
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wall])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-arith])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wstrict-prototypes])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-prototypes])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-declarations])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnested-externs])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wbad-function-cast])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wformat=2], [-Wformat])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wold-style-definition])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdeclaration-after-statement])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat])
AC_LANG_CASE(
[C], [
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
]
)
# This chunk adds additional warnings that could catch undesired effects.
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wunused])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wuninitialized])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wshadow])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-qual])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-noreturn])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-format-attribute])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
# These are currently disabled because they are noisy. They will be enabled
# in the future once the codebase is sufficiently modernized to silence
# them. For now, I don't want them to drown out the other warnings.
# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wlogical-op])
# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wparentheses])
# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-align])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
# Turn some warnings into errors, so we don't accidently get successful builds
# when there are problems that should be fixed.
if test "x$SELECTIVE_WERROR" = "xyes" ; then
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=nonnull])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=init-self])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=main])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=missing-braces])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=sequence-point])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=trigraphs])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=array-bounds])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=write-strings])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=address])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION
else
AC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors. This should not be necessary. Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wimplicit])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnonnull])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winit-self])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmain])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-braces])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wsequence-point])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wreturn-type])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wtrigraphs])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Warray-bounds])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wwrite-strings])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Waddress])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wint-to-pointer-cast])
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-to-int-cast])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast])
fi
AC_SUBST([BASE_CFLAGS])
AC_SUBST([BASE_]PREFIX[FLAGS])
]) # XORG_COMPILER_FLAGS
# XORG_CWARNFLAGS
@ -2604,11 +2685,15 @@ AC_SUBST([BASE_CFLAGS])
AC_DEFUN([XORG_CWARNFLAGS], [
AC_REQUIRE([XORG_COMPILER_FLAGS])
AC_REQUIRE([XORG_COMPILER_BRAND])
CWARNFLAGS="$BASE_CFLAGS"
if test "x$GCC" = xyes ; then
CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
fi
AC_SUBST(CWARNFLAGS)
AC_LANG_CASE(
[C], [
CWARNFLAGS="$BASE_CFLAGS"
if test "x$GCC" = xyes ; then
CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
fi
AC_SUBST(CWARNFLAGS)
]
)
]) # XORG_CWARNFLAGS
# XORG_STRICT_OPTION
@ -2618,7 +2703,7 @@ AC_SUBST(CWARNFLAGS)
# Add configure option to enable strict compilation flags, such as treating
# warnings as fatal errors.
# If --enable-strict-compilation is passed to configure, adds strict flags to
# $BASE_CFLAGS and the deprecated $CWARNFLAGS.
# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS.
#
# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
# when strict compilation is unconditionally desired.
@ -2631,21 +2716,30 @@ AC_ARG_ENABLE(strict-compilation,
[Enable all warnings from compiler and make them errors (default: disabled)]),
[STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
STRICT_CFLAGS=""
XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic])
XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn])
AC_LANG_CASE(
[C], [
define([PREFIX], [C])
],
[C++], [
define([PREFIX], [CXX])
]
)
[STRICT_]PREFIX[FLAGS]=""
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic])
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn])
# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not
# activate it with -Werror, so we add it here explicitly.
XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror=attributes])
XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes])
if test "x$STRICT_COMPILE" = "xyes"; then
BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS"
CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
[BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]"
AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"])
fi
AC_SUBST([STRICT_CFLAGS])
AC_SUBST([BASE_CFLAGS])
AC_SUBST([CWARNFLAGS])
AC_SUBST([STRICT_]PREFIX[FLAGS])
AC_SUBST([BASE_]PREFIX[FLAGS])
AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS]))
]) # XORG_STRICT_OPTION
# XORG_DEFAULT_OPTIONS

View File

@ -90,3 +90,35 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([libpciaccess],[0.13],
AC_INIT([libpciaccess],[0.13.1],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=libpciaccess],[libpciaccess])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
@ -31,6 +31,7 @@ AC_CONFIG_HEADERS([config.h])
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
AC_USE_SYSTEM_EXTENSIONS
# Initialize libtool
AC_PROG_LIBTOOL

View File

@ -70,4 +70,4 @@ libpciaccess_la_SOURCES = common_bridge.c \
libpciaccess_la_LIBADD = $(PCIACCESS_LIBS)
libpciaccess_la_LDFLAGS = -version-number 0:11:0 -no-undefined
libpciaccess_la_LDFLAGS = -version-number 0:11:1 -no-undefined

View File

@ -295,7 +295,7 @@ libpciaccess_la_SOURCES = common_bridge.c \
$(OS_SUPPORT)
libpciaccess_la_LIBADD = $(PCIACCESS_LIBS)
libpciaccess_la_LDFLAGS = -version-number 0:11:0 -no-undefined
libpciaccess_la_LDFLAGS = -version-number 0:11:1 -no-undefined
all: all-am
.SUFFIXES:

View File

@ -51,6 +51,7 @@
#define DO_MATCH(a,b) (((a) == PCI_MATCH_ANY) || ((a) == (b)))
#ifdef HAVE_ZLIB
#include <zlib.h>
typedef gzFile pci_id_file;
@ -68,11 +69,28 @@ pci_id_file_open(void)
#define pci_id_file_gets(l, s, f) gzgets(f, l, s)
#define pci_id_file_close(f) gzclose(f)
#else
#else /* not zlib */
typedef FILE * pci_id_file;
#define pci_id_file_open() fopen(PCIIDS_PATH "/pci.ids", "r")
static pci_id_file
pci_id_file_open(void)
{
pci_id_file result;
#ifndef __sun
result = fopen(PCIIDS_PATH "/pci.ids", "re");
if (result)
return result;
#endif
return fopen(PCIIDS_PATH "/pci.ids", "r");
}
#define pci_id_file_gets(l, s, f) fgets(l, s, f)
#define pci_id_file_close(f) fclose(f)
#endif
/**

View File

@ -129,7 +129,7 @@ pci_device_vgaarb_init(void)
if (!pci_sys)
return -1;
if ((pci_sys->vgaarb_fd = open ("/dev/vga_arbiter", O_RDWR)) < 0) {
if ((pci_sys->vgaarb_fd = open ("/dev/vga_arbiter", O_RDWR | O_CLOEXEC)) < 0) {
return errno;
}

View File

@ -108,7 +108,7 @@ pci_device_freebsd_map_range(struct pci_device *dev,
int fd, err = 0;
fd = open("/dev/mem", O_RDWR);
fd = open("/dev/mem", O_RDWR | O_CLOEXEC);
if (fd == -1)
return errno;
@ -153,7 +153,7 @@ pci_device_freebsd_unmap_range( struct pci_device *dev,
if ((map->flags & PCI_DEV_MAP_FLAG_CACHABLE) ||
(map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE))
{
fd = open("/dev/mem", O_RDWR);
fd = open("/dev/mem", O_RDWR | O_CLOEXEC);
if (fd != -1) {
mrd.mr_base = map->base;
mrd.mr_len = map->size;
@ -293,7 +293,7 @@ pci_device_freebsd_read_rom( struct pci_device * dev, void * buffer )
}
printf("Using rom_base = 0x%lx\n", (long)rom_base);
memfd = open( "/dev/mem", O_RDONLY );
memfd = open( "/dev/mem", O_RDONLY | O_CLOEXEC );
if ( memfd == -1 )
return errno;
@ -585,7 +585,7 @@ pci_system_freebsd_create( void )
int i;
/* Try to open the PCI device */
pcidev = open( "/dev/pci", O_RDWR );
pcidev = open( "/dev/pci", O_RDWR | O_CLOEXEC );
if ( pcidev == -1 )
return ENXIO;

View File

@ -51,9 +51,9 @@
#define inb(x) -1
#define inw(x) -1
#define inl(x) -1
#define outb(x) do {} while (0)
#define outw(x) do {} while (0)
#define outl(x) do {} while (0)
#define outb(x,y) do {} while (0)
#define outw(x,y) do {} while (0)
#define outl(x,y) do {} while (0)
#define iopl(x) -1
#endif
@ -98,7 +98,7 @@ pci_system_linux_sysfs_create( void )
if ( pci_sys != NULL ) {
pci_sys->methods = & linux_sysfs_methods;
#ifdef HAVE_MTRR
pci_sys->mtrr_fd = open("/proc/mtrr", O_WRONLY);
pci_sys->mtrr_fd = open("/proc/mtrr", O_WRONLY | O_CLOEXEC);
#endif
err = populate_entries(pci_sys);
}
@ -245,7 +245,7 @@ pci_device_linux_sysfs_probe( struct pci_device * dev )
dev->bus,
dev->dev,
dev->func );
fd = open( name, O_RDONLY );
fd = open( name, O_RDONLY | O_CLOEXEC);
if ( fd != -1 ) {
char * next;
pciaddr_t low_addr;
@ -307,7 +307,7 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer )
dev->dev,
dev->func );
fd = open( name, O_RDWR );
fd = open( name, O_RDWR | O_CLOEXEC);
if ( fd == -1 ) {
#ifdef LINUX_ROM
/* If reading the ROM using sysfs fails, fall back to the old
@ -388,7 +388,7 @@ pci_device_linux_sysfs_read( struct pci_device * dev, void * data,
dev->dev,
dev->func );
fd = open( name, O_RDONLY );
fd = open( name, O_RDONLY | O_CLOEXEC);
if ( fd == -1 ) {
return errno;
}
@ -448,7 +448,7 @@ pci_device_linux_sysfs_write( struct pci_device * dev, const void * data,
dev->dev,
dev->func );
fd = open( name, O_WRONLY );
fd = open( name, O_WRONLY | O_CLOEXEC);
if ( fd == -1 ) {
return errno;
}
@ -499,7 +499,7 @@ pci_device_linux_sysfs_map_range_wc(struct pci_device *dev,
dev->dev,
dev->func,
map->region);
fd = open(name, open_flags);
fd = open(name, open_flags | O_CLOEXEC);
if (fd == -1)
return errno;
@ -564,7 +564,7 @@ pci_device_linux_sysfs_map_range(struct pci_device *dev,
dev->func,
map->region);
fd = open(name, open_flags);
fd = open(name, open_flags | O_CLOEXEC);
if (fd == -1) {
return errno;
}
@ -687,7 +687,7 @@ static void pci_device_linux_sysfs_enable(struct pci_device *dev)
dev->dev,
dev->func );
fd = open( name, O_RDWR );
fd = open( name, O_RDWR | O_CLOEXEC);
if (fd == -1)
return;
@ -709,7 +709,7 @@ static int pci_device_linux_sysfs_boot_vga(struct pci_device *dev)
dev->dev,
dev->func );
fd = open( name, O_RDONLY );
fd = open( name, O_RDONLY | O_CLOEXEC);
if (fd == -1)
return 0;
@ -752,7 +752,7 @@ pci_device_linux_sysfs_open_device_io(struct pci_io_handle *ret,
snprintf(name, PATH_MAX, "%s/%04x:%02x:%02x.%1u/resource%d",
SYS_BUS_PCI, dev->domain, dev->bus, dev->dev, dev->func, bar);
ret->fd = open(name, O_RDWR);
ret->fd = open(name, O_RDWR | O_CLOEXEC);
if (ret->fd < 0)
return NULL;
@ -775,7 +775,7 @@ pci_device_linux_sysfs_open_legacy_io(struct pci_io_handle *ret,
snprintf(name, PATH_MAX, "/sys/class/pci_bus/%04x:%02x/legacy_io",
dev->domain, dev->bus);
ret->fd = open(name, O_RDWR);
ret->fd = open(name, O_RDWR | O_CLOEXEC);
if (ret->fd >= 0)
break;
@ -897,7 +897,7 @@ pci_device_linux_sysfs_map_legacy(struct pci_device *dev, pciaddr_t base,
snprintf(name, PATH_MAX, "/sys/class/pci_bus/%04x:%02x/legacy_mem",
dev->domain, dev->bus);
fd = open(name, flags);
fd = open(name, flags | O_CLOEXEC);
if (fd >= 0)
break;
@ -906,7 +906,7 @@ pci_device_linux_sysfs_map_legacy(struct pci_device *dev, pciaddr_t base,
/* If not, /dev/mem is the best we can do */
if (!dev)
fd = open("/dev/mem", flags);
fd = open("/dev/mem", flags | O_CLOEXEC);
if (fd < 0)
return errno;

View File

@ -94,7 +94,7 @@ pci_device_netbsd_map_range(struct pci_device *dev,
struct mtrr mtrr;
int fd, error, nmtrr, prot = PROT_READ;
if ((fd = open("/dev/mem", O_RDWR)) == -1)
if ((fd = open("/dev/mem", O_RDWR | O_CLOEXEC)) == -1)
return errno;
if (map->flags & PCI_DEV_MAP_FLAG_WRITABLE)
@ -328,7 +328,7 @@ pci_system_netbsd_create(void)
int bus, dev, func, ndevs, nfuncs;
uint32_t reg;
pcifd = open("/dev/pci0", O_RDWR);
pcifd = open("/dev/pci0", O_RDWR | O_CLOEXEC);
if (pcifd == -1)
return ENXIO;

View File

@ -569,7 +569,7 @@ pci_system_openbsd_create(void)
for (domain = 0; domain < sizeof(pcifd) / sizeof(pcifd[0]); domain++) {
snprintf(path, sizeof(path), "/dev/pci%d", domain);
pcifd[domain] = open(path, O_RDWR);
pcifd[domain] = open(path, O_RDWR | O_CLOEXEC);
if (pcifd[domain] == -1)
break;
ndomains++;

View File

@ -37,6 +37,19 @@
# define _pci_hidden
#endif /* GNUC >= 4 */
/*
* O_CLOEXEC fixes an fd leak case (see 'man 2 open' for details). I don't
* know of any OS we support where this isn't available in a sufficiently
* new version, so warn unconditionally.
*/
#include <sys/fcntl.h>
#ifndef O_CLOEXEC
#warning O_CLOEXEC not available, please upgrade.
#define O_CLOEXEC 0
#endif
struct pci_device_mapping;
int pci_fill_capabilities_generic( struct pci_device * dev );

View File

@ -663,7 +663,7 @@ probe_nexus_node(di_node_t di_node, di_minor_t minor, void *arg)
nexus_path, first_bus, last_bus);
#endif
if ((fd = open(nexus_path, O_RDWR)) >= 0) {
if ((fd = open(nexus_path, O_RDWR | O_CLOEXEC)) >= 0) {
nexus->fd = fd;
nexus->path = strdup(nexus_path);
nexus_dev_path = di_devfs_path(di_node);
@ -931,7 +931,7 @@ pci_device_solx_devfs_map_range(struct pci_device *dev,
else
strcpy (map_dev, "/dev/fb0");
if ((map_fd = open(map_dev, O_RDWR)) < 0) {
if ((map_fd = open(map_dev, O_RDWR | O_CLOEXEC)) < 0) {
err = errno;
(void) fprintf(stderr, "can not open %s: %s\n", map_dev,
strerror(errno));
@ -944,7 +944,7 @@ pci_device_solx_devfs_map_range(struct pci_device *dev,
* Still used xsvc to do the user space mapping
*/
if (xsvc_fd < 0) {
if ((xsvc_fd = open("/dev/xsvc", O_RDWR)) < 0) {
if ((xsvc_fd = open("/dev/xsvc", O_RDWR | O_CLOEXEC)) < 0) {
err = errno;
(void) fprintf(stderr, "can not open /dev/xsvc: %s\n",
strerror(errno));

View File

@ -330,7 +330,7 @@ pci_device_x86_read_rom(struct pci_device *dev, void *buffer)
return ENOSYS;
}
memfd = open("/dev/mem", O_RDONLY);
memfd = open("/dev/mem", O_RDONLY | O_CLOEXEC);
if (memfd == -1)
return errno;
@ -475,7 +475,7 @@ static int
pci_device_x86_map_range(struct pci_device *dev,
struct pci_device_mapping *map)
{
int memfd = open("/dev/mem", O_RDWR);
int memfd = open("/dev/mem", O_RDWR | O_CLOEXEC);
int prot = PROT_READ;
if (memfd == -1)