Re: [PATCH] disk-utils: fix libuuid usage in mkswap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Karel Zak <kzak@xxxxxxxxxx> writes:
>  It would be nice to have a script that compares all HAVE_* from code
>  to the config.h.in
>
>       $ grep -r HAVE_ *   
>  
>  ... and I see that cal.c uses HAVE_NCURSES, but we have
>  HAVE_NCURSES_H only :-(

Something like this (first approach)?

------------------------------------------------------------------
#! /bin/bash

srcdir=$1

if [ ! "$srcdir" ]; then
	srcdir=$PWD
fi

CONFIG="$srcdir/config.h.in"
if [ ! -f "$CONFIG" ]; then
	echo "config.h.in is needed"
	exit 1
fi

SOURCES=$(find $srcdir -name "*.c")

for f in $SOURCES; do
	DEFINES=$(sed -n -e 's/.*\(HAVE_[[:alnum:]]\+[^ \t);]*\).*/\1/p' \
                         -e 's/.*\(ENABLE_[[:alnum:]]\+[^ \t);]*\).*/\1/p' \
                         $f | sort | uniq)
	for d in $DEFINES; do
		case $d in
		HAVE_CONFIG_H) continue;;
		*) grep -q "$d\( \|\>\)" $CONFIG || echo "$(basename $f): $d"
	           ;;
		esac
	done
done
-------------------------------------------------------------------

Still, most of the results are false positives:

login.c: HAVE_UT_TV
_HAVE_UT_TV defined in bits/utmp.h

shutdown.c: ENABLE_CAD
false positive

mkfs.cramfs.c: HAVE_MD5
false positive, defined in source

mcookie.c: HAVE_GETTIMEOFDAY
false positive, defined in source

cal.c: HAVE_NCURSES
Already been mentioned

getopt.c: HAVE_LIBINTL_H
Refers to getopt/gnu/getopt.c
gettext related? I am not really sure where this is supposed to come from.
Anyway, the source file seems to be not used at all, gnu/getopt.c looks 
like a fallback implementation for getopt, but there is no configure 
check or anything in the build infrastructure which might trigger this.

Matthias

-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux