diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2022-11-06 19:29:08 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2022-11-06 19:29:08 +0000 |
commit | c8f3aac0b6fc15e33b24d8f4966d1f032984471b (patch) | |
tree | 35281975a2f20a15879f535157e880220f27818d /util/makedepend | |
parent | 6a6dd7faefe1537d480364c29a87b9edf67dae67 (diff) |
Update makedepend to version 1.0.7
Diffstat (limited to 'util/makedepend')
-rw-r--r-- | util/makedepend/ChangeLog | 69 | ||||
-rw-r--r-- | util/makedepend/Makefile.am | 4 | ||||
-rw-r--r-- | util/makedepend/Makefile.in | 14 | ||||
-rw-r--r-- | util/makedepend/aclocal.m4 | 16 | ||||
-rw-r--r-- | util/makedepend/compile | 17 | ||||
-rw-r--r-- | util/makedepend/configure | 52 | ||||
-rw-r--r-- | util/makedepend/configure.ac | 9 | ||||
-rw-r--r-- | util/makedepend/def.h | 1 | ||||
-rw-r--r-- | util/makedepend/include.c | 34 | ||||
-rw-r--r-- | util/makedepend/main.c | 1 | ||||
-rw-r--r-- | util/makedepend/test-driver | 27 | ||||
-rw-r--r-- | util/makedepend/tests/1/makedep.sh | 39 | ||||
-rw-r--r-- | util/makedepend/tests/1/one.cpp | 1 | ||||
-rw-r--r-- | util/makedepend/tests/1/two.cpp | 1 |
14 files changed, 226 insertions, 59 deletions
diff --git a/util/makedepend/ChangeLog b/util/makedepend/ChangeLog index 12ef184d6..a6b35f51a 100644 --- a/util/makedepend/ChangeLog +++ b/util/makedepend/ChangeLog @@ -1,3 +1,70 @@ +commit d62a9e49c6b83f05c5692bbe4b80c485d08ecfd3 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Fri Oct 28 19:28:57 2022 -0700 + + makedepend 1.0.7 + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 542a6dd61ce334924494af2fcf8a4613ef86aace +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Jun 18 09:50:04 2022 -0700 + + Use AC_CONFIG_FILES to replace the deprecated AC_OUTPUT with parameters + + configure.ac:32: warning: AC_OUTPUT should be used without arguments. + configure.ac:32: You should run autoupdate. + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 3dc64b0b0a7d4e14ccea6b9d1d11bf871c47a7e0 +Author: Thibault DUPONCHELLE <thibault.duponchelle@gmail.com> +Date: Wed Mar 20 09:26:47 2019 +0100 + + Add test case for bug #1 + proposed fix. + + Fixes: https://gitlab.freedesktop.org/xorg/util/makedepend/issues/1 + +commit 54559e73e27e532535dea2a60e615f99c694343f +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sun Apr 10 09:32:55 2022 -0700 + + gitlab CI: stop requiring Signed-off-by in commits + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit c2ffd57727e5f02b94f1c46392a740e404d4c270 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sun Apr 10 09:18:41 2022 -0700 + + Close fd for reading old Makefile when done, instead of leaking it + + Found by Oracle Parfait: + + Error: File Leak + File Leak [file-ptr-leak]: + Leaked File fdin + at line 799 of main.c in function 'redirect'. + fdin initialized at line 769 with fopen + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 093d33fb6bc108030539b38c4bfa202b148d3c7a +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Jan 15 15:44:38 2022 -0800 + + gitlab CI: add a basic build test + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 9b11c9bdf94e620a58e4402f7c2a98e7fc01e859 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Jan 15 15:43:28 2022 -0800 + + Build xz tarballs instead of bzip2 + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + commit e4971e9507f989d68c97a92edd1e6e1881ad1d55 Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Sat Mar 16 16:39:07 2019 -0700 @@ -510,7 +577,7 @@ Date: Fri May 14 21:14:44 2010 -0700 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> commit 8522c314da7537169996476fe5ba411f720a09fe -Author: Martin Pärtel <lagitus@mbnet.fi> +Author: Martin Pärtel <lagitus@mbnet.fi> Date: Fri May 14 21:00:15 2010 -0700 Bug 28045 - makedepend fails on directory named like an include file diff --git a/util/makedepend/Makefile.am b/util/makedepend/Makefile.am index 00b695ef8..1eb2eb869 100644 --- a/util/makedepend/Makefile.am +++ b/util/makedepend/Makefile.am @@ -71,3 +71,7 @@ TESTS_ENVIRONMENT += test_srcdir="$(TEST_SRCDIR_PATH)/tests" # Test for https://bugs.freedesktop.org/show_bug.cgi?id=28045 TESTS += tests/28045/makedep.sh EXTRA_DIST += tests/28045/makedep.sh tests/28045/foo.cpp + +# Test +TESTS += tests/1/makedep.sh +EXTRA_DIST += tests/1/makedep.sh tests/1/one.cpp tests/1/two.cpp diff --git a/util/makedepend/Makefile.in b/util/makedepend/Makefile.in index 3d1f96ff4..3e0e77ec0 100644 --- a/util/makedepend/Makefile.in +++ b/util/makedepend/Makefile.in @@ -155,9 +155,9 @@ am__remove_distdir = \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) -DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz GZIP_ENV = --best -DIST_TARGETS = dist-bzip2 dist-gzip +DIST_TARGETS = dist-xz dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -279,6 +279,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -301,7 +302,8 @@ AM_CPPFLAGS = -DOBJSUFFIX=\".${OBJEXT}\" -DINCLUDEDIR=\"/usr/include\" \ $(X_CFLAGS) AM_CFLAGS = $(CWARNFLAGS) EXTRA_DIST = autogen.sh makedepend.man README.md ChangeLog \ - tests/28045/makedep.sh tests/28045/foo.cpp + tests/28045/makedep.sh tests/28045/foo.cpp tests/1/makedep.sh \ + tests/1/one.cpp tests/1/two.cpp # Man page appmandir = $(APP_MAN_DIR) @@ -317,7 +319,9 @@ MAINTAINERCLEANFILES = ChangeLog ### Test cases - mostly for bug fixes submitted with a test case so far # Test for https://bugs.freedesktop.org/show_bug.cgi?id=28045 -TESTS = tests/28045/makedep.sh + +# Test +TESTS = tests/28045/makedep.sh tests/1/makedep.sh # Absolute path to srcdir & builddir top that test scripts can reference TEST_BUILDDIR_PATH = `cd $(top_builddir) && pwd` @@ -691,6 +695,7 @@ distdir: $(DISTFILES) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) + dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) @@ -698,7 +703,6 @@ dist-bzip2: distdir dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) - dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) diff --git a/util/makedepend/aclocal.m4 b/util/makedepend/aclocal.m4 index 2a518c4b6..d0a818e1e 100644 --- a/util/makedepend/aclocal.m4 +++ b/util/makedepend/aclocal.m4 @@ -19,9 +19,9 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -dnl serial 11 (pkg-config-0.29.1) -dnl +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 12 (pkg-config-0.29.2) + dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>. dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com> dnl @@ -62,7 +62,7 @@ dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29.1]) +[m4_define([PKG_MACROS_VERSION], [0.29.2]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ @@ -163,7 +163,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no -AC_MSG_CHECKING([for $1]) +AC_MSG_CHECKING([for $2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) @@ -173,11 +173,11 @@ and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs @@ -194,7 +194,7 @@ installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full diff --git a/util/makedepend/compile b/util/makedepend/compile index a85b723c7..df363c8fb 100644 --- a/util/makedepend/compile +++ b/util/makedepend/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2012-10-14.11; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey <tromey@cygnus.com>. # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) @@ -255,7 +255,8 @@ EOF echo "compile $scriptversion" exit $? ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac @@ -339,9 +340,9 @@ exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/util/makedepend/configure b/util/makedepend/configure index 54e9d4b83..2d07851e4 100644 --- a/util/makedepend/configure +++ b/util/makedepend/configure @@ -1,8 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for makedepend 1.0.6. +# Generated by GNU Autoconf 2.69 for makedepend 1.0.7. # -# Report bugs to <https://gitlab.freedesktop.org/xorg/util/makedepend/issues>. +# Report bugs to <https://gitlab.freedesktop.org/xorg/util/makedepend/-/issues>. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -267,7 +267,7 @@ fi $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: https://gitlab.freedesktop.org/xorg/util/makedepend/issues +$0: https://gitlab.freedesktop.org/xorg/util/makedepend/-/issues $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do @@ -581,9 +581,9 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='makedepend' PACKAGE_TARNAME='makedepend' -PACKAGE_VERSION='1.0.6' -PACKAGE_STRING='makedepend 1.0.6' -PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/util/makedepend/issues' +PACKAGE_VERSION='1.0.7' +PACKAGE_STRING='makedepend 1.0.7' +PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/util/makedepend/-/issues' PACKAGE_URL='' ac_unique_file="Makefile.am" @@ -733,6 +733,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -817,6 +818,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1069,6 +1071,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1206,7 +1217,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1319,7 +1330,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures makedepend 1.0.6 to adapt to many kinds of systems. +\`configure' configures makedepend 1.0.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1359,6 +1370,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1389,7 +1401,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of makedepend 1.0.6:";; + short | recursive ) echo "Configuration of makedepend 1.0.7:";; esac cat <<\_ACEOF @@ -1442,7 +1454,7 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to <https://gitlab.freedesktop.org/xorg/util/makedepend/issues>. +Report bugs to <https://gitlab.freedesktop.org/xorg/util/makedepend/-/issues>. _ACEOF ac_status=$? fi @@ -1505,7 +1517,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -makedepend configure 1.0.6 +makedepend configure 1.0.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1829,7 +1841,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by makedepend $as_me 1.0.6, which was +It was created by makedepend $as_me 1.0.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2658,7 +2670,7 @@ fi # Define the identity of the package. PACKAGE='makedepend' - VERSION='1.0.6' + VERSION='1.0.7' cat >>confdefs.h <<_ACEOF @@ -10798,8 +10810,8 @@ fi pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 -$as_echo_n "checking for X... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xproto >= 7.0.17" >&5 +$as_echo_n "checking for xproto >= 7.0.17... " >&6; } if test -n "$X_CFLAGS"; then pkg_cv_X_CFLAGS="$X_CFLAGS" @@ -10839,7 +10851,7 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -10866,7 +10878,7 @@ Alternatively, you may set the environment variables X_CFLAGS and X_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} @@ -11428,7 +11440,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by makedepend $as_me 1.0.6, which was +This file was extended by makedepend $as_me 1.0.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11488,13 +11500,13 @@ $config_headers Configuration commands: $config_commands -Report bugs to <https://gitlab.freedesktop.org/xorg/util/makedepend/issues>." +Report bugs to <https://gitlab.freedesktop.org/xorg/util/makedepend/-/issues>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -makedepend config.status 1.0.6 +makedepend config.status 1.0.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/util/makedepend/configure.ac b/util/makedepend/configure.ac index 6379d7848..761cbe4bf 100644 --- a/util/makedepend/configure.ac +++ b/util/makedepend/configure.ac @@ -3,13 +3,13 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([makedepend], [1.0.6], - [https://gitlab.freedesktop.org/xorg/util/makedepend/issues]) +AC_INIT([makedepend], [1.0.7], + [https://gitlab.freedesktop.org/xorg/util/makedepend/-/issues]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([makedepend-config.h]) # Initialize Automake -AM_INIT_AUTOMAKE([foreign dist-bzip2]) +AM_INIT_AUTOMAKE([foreign dist-xz]) # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], @@ -29,4 +29,5 @@ AC_SYS_LARGEFILE dnl Check for pkg-config packages PKG_CHECK_MODULES(X, [xproto >= 7.0.17]) -AC_OUTPUT([Makefile]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/util/makedepend/def.h b/util/makedepend/def.h index 17ce537f3..479adcc4e 100644 --- a/util/makedepend/def.h +++ b/util/makedepend/def.h @@ -42,6 +42,7 @@ in this Software without prior written authorization from The Open Group. #define MAXFILES 2048 #define MAXINCFILES 128 /* "-include" files */ #define MAXDIRS 512 /* -I flags */ +#define PATHMAX 4096 /* realpath */ #define SYMTABINC 10 /* must be > 1 for define() to work right */ #define TRUE 1 #define FALSE 0 diff --git a/util/makedepend/include.c b/util/makedepend/include.c index 159dfc718..697e9de53 100644 --- a/util/makedepend/include.c +++ b/util/makedepend/include.c @@ -241,8 +241,38 @@ inc_path(const char *file, const char *include, int type) for (; ip->i_file; ip++) { if ((strcmp(ip->i_incstring, include) == 0) && !(ip->i_flags & INCLUDED_SYM)) { - inclistnext = ip + 1; - return ip; + /* + * Same filename but same file ? + */ + char r_include[PATHMAX+1]; + char r_saved_path[PATHMAX+1]; + char* ptr; + ptr = realpath(include, r_include); + ptr = realpath(ip->i_file, r_saved_path); + if (!strcmp(r_include, r_saved_path)) { + inclistnext = ip + 1; + return ip; + } + + /* + * Check if we have a header in the same dir + */ + for (p=file+strlen(file); p>file; p--) + if (*p == '/') + break; + if (p == file) { + strcpy(path, include); + } else { + strncpy(path, file, (p-file) + 1); + path[ (p-file) + 1 ] = '\0'; + strcpy(path + (p-file) + 1, include); + } + remove_dotdot(path); + ptr = realpath(path, r_include); + if (!strcmp(r_include, r_saved_path)) { + inclistnext = ip + 1; + return ip; + } } } diff --git a/util/makedepend/main.c b/util/makedepend/main.c index 871588151..816243fc7 100644 --- a/util/makedepend/main.c +++ b/util/makedepend/main.c @@ -790,6 +790,7 @@ redirect(const char *line, const char *makefile) fputs(buf, fdout); } } + fclose(fdin); fflush(fdout); #ifndef HAVE_FCHMOD chmod(makefile, st.st_mode); diff --git a/util/makedepend/test-driver b/util/makedepend/test-driver index 8e575b017..be73b80ad 100644 --- a/util/makedepend/test-driver +++ b/util/makedepend/test-driver @@ -1,9 +1,9 @@ #! /bin/sh # test-driver - basic testsuite driver script. -scriptversion=2013-07-13.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2014 Free Software Foundation, Inc. +# Copyright (C) 2011-2021 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ scriptversion=2013-07-13.22; # UTC # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -42,11 +42,13 @@ print_usage () { cat <<END Usage: - test-driver --test-name=NAME --log-file=PATH --trs-file=PATH - [--expect-failure={yes|no}] [--color-tests={yes|no}] - [--enable-hard-errors={yes|no}] [--] + test-driver --test-name NAME --log-file PATH --trs-file PATH + [--expect-failure {yes|no}] [--color-tests {yes|no}] + [--enable-hard-errors {yes|no}] [--] TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] + The '--test-name', '--log-file' and '--trs-file' options are mandatory. +See the GNU Automake documentation for information. END } @@ -103,8 +105,11 @@ trap "st=130; $do_exit" 2 trap "st=141; $do_exit" 13 trap "st=143; $do_exit" 15 -# Test script is run here. -"$@" >$log_file 2>&1 +# Test script is run here. We create the file first, then append to it, +# to ameliorate tests themselves also writing to the log file. Our tests +# don't, but others can (automake bug#35762). +: >"$log_file" +"$@" >>"$log_file" 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then @@ -126,7 +131,7 @@ esac # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). -echo "$res $test_name (exit status: $estatus)" >>$log_file +echo "$res $test_name (exit status: $estatus)" >>"$log_file" # Report outcome to console. echo "${col}${res}${std}: $test_name" @@ -140,9 +145,9 @@ echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/util/makedepend/tests/1/makedep.sh b/util/makedepend/tests/1/makedep.sh new file mode 100644 index 000000000..f24e2ffaa --- /dev/null +++ b/util/makedepend/tests/1/makedep.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +# Test case for bug https://gitlab.freedesktop.org/xorg/util/makedepend/issues/1 + +set -e + +if [ "x$test_srcdir" = "x" ]; then + test_srcdir=.. +fi + +if [ "x$test_builddir" = "x" ]; then + test_builddir=.. +fi + +if [ "x$MAKEDEPEND" = "x" ]; then + MAKEDEPEND=makedepend +fi + +mkdir -p ${test_builddir}/1 +cd ${test_builddir}/1 + +pwd + +# Create test conditions: +# - directory named "one" containing file one.cpp which includes def.h in the same directory +# - directory named "two" containing file two.cpp which includes def.h in the same directory +mkdir -p one two + +# 2 headers with the same name but in different directories +touch one/def.h two/def.h +cp ${test_srcdir}/1/one.cpp one/ +cp ${test_srcdir}/1/two.cpp two/ + +# two/two.cpp depends on two/def.h (not the one seen during exploration in previous directory) +$MAKEDEPEND -f- -I. one/one.cpp two/two.cpp | grep "two/two.o: one/def.h" && false + + +# Clean up +rm -rf one two diff --git a/util/makedepend/tests/1/one.cpp b/util/makedepend/tests/1/one.cpp new file mode 100644 index 000000000..bb9f760d7 --- /dev/null +++ b/util/makedepend/tests/1/one.cpp @@ -0,0 +1 @@ +#include "def.h" diff --git a/util/makedepend/tests/1/two.cpp b/util/makedepend/tests/1/two.cpp new file mode 100644 index 000000000..bb9f760d7 --- /dev/null +++ b/util/makedepend/tests/1/two.cpp @@ -0,0 +1 @@ +#include "def.h" |