From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25978 invoked by alias); 25 Mar 2011 00:46:07 -0000 Received: (qmail 25965 invoked by uid 22791); 25 Mar 2011 00:46:05 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT,TW_BT,TW_DB X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.152) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Mar 2011 00:46:00 +0000 Received: from md1.u-strasbg.fr (md1.u-strasbg.fr [IPv6:2001:660:2402::186]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id p2P0juLL049517 for ; Fri, 25 Mar 2011 01:45:57 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms4.u-strasbg.fr [130.79.204.13]) by md1.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p2P0jun1082496 for ; Fri, 25 Mar 2011 01:45:56 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p2P0jtY5080536 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Fri, 25 Mar 2011 01:45:56 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: Subject: [RFC] Missing files in Makefile.in Date: Fri, 25 Mar 2011 09:58:00 -0000 Message-ID: <004701cbea86$01b94f30$052bed90$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit x-cr-hashedpuzzle: AMKP BBQ4 Bhjd BzCj Dx/K E/+Q FJCc FRvM GdeX GmCi HhkN Jybj KGO4 KzU1 K6e0 LDRW;1;ZwBkAGIALQBwAGEAdABjAGgAZQBzAEAAcwBvAHUAcgBjAGUAdwBhAHIAZQAuAG8AcgBnAA==;Sosha1_v1;7;{324B44D8-7B68-489C-9436-A160C96CDC1E};cABpAGUAcgByAGUALgBtAHUAbABsAGUAcgBAAGkAYwBzAC0AYwBuAHIAcwAuAHUAbgBpAHMAdAByAGEALgBmAHIA;Fri, 25 Mar 2011 00:45:50 GMT;WwBSAEYAQwBdACAATQBpAHMAcwBpAG4AZwAgAGYAaQBsAGUAcwAgAGkAbgAgAE0AYQBrAGUAZgBpAGwAZQAuAGkAbgA= x-cr-puzzleid: {324B44D8-7B68-489C-9436-A160C96CDC1E} Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg01089.txt.bz2 To achieve a better job for ARI, I wanted to create two lists: one for files that are only used for native configuration and a second for files that are used for several targets. The idea behind this is that lots of ARI rules should only apply to files that are shared for several architectures. To give an example, the 'long long' rule should only trigger for non native sources. While doing this I noticed that there are some sources that are currently nowhere to be found inside Makefile.in List of not listed headers: amd64-darwin-tdep.h charset-list.h common/gdb_signals.h common/i386-xstate.h config/djgpp/langinfo.h config/djgpp/nl_types.h darwin-nat.h dicos-tdep.h filesystem.h gcore.h gdb_wchar.h hppabsd-tdep.h i386-darwin-tdep.h i386-nat.h linux-record.h moxie-tdep.h osdata.h procfs.h python/py-event.h python/py-events.h python/py-stopevent.h python/python-internal.h python/python.h ravenscar-thread.h record.h solib-darwin.h solib-ia64-hpux.h solib-spu.h windows-nat.h xcoffread.h List of not listed c sources: annotate.c common/signals.c copying.c dfp.c gdb.c inf-child.c regset.c windows-termcap.c I also noticed that there are files located in gdbserver subdirectory that are listed in this Makefile.in... Should we do something about those inconsistencies? Pierre Muller GDB pascal language maintainer PS: Below is the script that I used to try to generate those listings. Warning, this generates lots of list* files To use it you might need to change the value of list variable near the start of the script. Used script: #!/bin/bash list=~/htdocs/www/local/ari/list # Find pattern $1 in config directory and subdirs function find_in_config_dir { echo "Looking for $1 in config directory" find config -type f | xargs -n 1 gawk ' /'$1'/, ! /\\$/ { \ if ($0 ~ /'$1'/) { \ header = gensub (/(^.*)=.*/, \ "# \\1 found in " FILENAME ":" FNR "\n", 1); \ } else { header = ""; } \ sub(/'$1' *= */, ""); sub (/\\$/, ""); gsub ( /[ \t]+/, "\n"); \ sub(/^#.*/ ,""); sub (/^/, header); print $0;}' > $2.tmp cat $2.tmp | sort | uniq > $2 # rm $2.tmp } # Same as above, but prepend the current subdirectory # if the answer has no directory. function find_nat_headers { echo "Looking for $1 in config directory" find config -type f | xargs -n 1 gawk ' /'$1'/, ! /\\$/ { \ if ($0 ~ /'$1'/) { \ header = gensub (/(^.*)=(.*)$/, \ "# \\1 found in " FILENAME ":" FNR " is \"\\2\"\n", 1); \ } else { header = ""; } \ subdir = gensub (/\/[^\/]*$/, "/", 1, FILENAME); \ sub(/'$1' *= */, ""); sub (/\\$/, ""); gsub ( /[ \t]+/, "\n"); \ sub(/^#.*/ ,""); $0 = gensub (/^([^/]*)$/, subdir "\\1", 1); \ sub (/^/, header); print $0;}' > $2.tmp cat $2.tmp | sort | uniq > $2 # rm $2.tmp } # Search for patterns in list of native headers function find_nat_defines { echo "Looking for \"$1\" in native headers" sed -e "/^#/d" $2 > $2.strip cat $2.strip | xargs -n 1 gawk ' /#[ \t]*'$1'/, ! /\\$/ { \ if ($0 ~ /'$1'/) { \ sub(/^.*'$1'[ \t]*/, ""); macro_name = gensub (/([A-Za-z0-9_]*).*/ ,"\\1", 1); header = "# \"" macro_name "\" found in " FILENAME ":" FNR \ "\n# macro is \"" $0 "\""; \ $0 = macro_name "\n" header; \ } else { header = ""; $0 = "# " $0;} print $0;}' > $3.tmp cat $3.tmp | sort | uniq > $3 # rm $3.tmp } # Parameter 1: file containing list of macros # Parameter 2: file containing list of sources to check # Parameter 3: output file function find_nat_defines_uses { echo "Looking for use of macros defined native headers in $2" sed -e "/^#/d" $1 > $1.strip sed -e "/^#/d" $2 > $2.strip rm -f $3.tmp $3.awk echo '# Looking for use of macros' > $3.awk echo 'FNR == 1 { in_comment = 0; }' >> $3.awk echo '#Remove comment inside one line' >> $3.awk echo '/\/\*.*\*\// { sub (/\/\*.*\*\//, ""); } ' >> $3.awk echo '/\/\*/ { in_comment = 1; sub (/\/*.*$/, ""); } ' >> $3.awk echo '/\*\// && in_comment {in_comment=0; sub (/^.*\*\//, "");}' >> $3.awk echo '/%/ { sub (/%.*$/, "");}' >> $3.awk for f in `cat $1.strip` ; do echo "#Looking for macro $f" >> $3.awk echo ' /(^|[^A-Za-z0-9_])'$f'($|[^A-Za-z0-9_])/ { \ $0 = "'$f': " FILENAME ":" FNR "\n# \"'$f'\" found in \ " FILENAME ":" FNR "\n# line is \"" $0 "\""; \ print $0;}' >> $3.awk done; if [ -f $3.awk ] ; then cat $2.strip | xargs -n 1 gawk -f $3.awk > $3.tmp cat $3.tmp > $3 fi # rm $3.tmp } function find_in_makefile_in { echo "Looking for $1 in Makefile.in" # We also need to get rid of any @VAR@ echo Makefile.in | xargs -n 1 gawk ' /'$1' *=/, ! /\\$/ { \ if ($0 ~ /'$1'/) { \ header = gensub (/(^.*'$1'[^ \t]*)[ \t]*=.*/, \ "# \\1 found in " FILENAME ":" FNR "\n", 1); \ } else { header = "" } \ sub (/^.*'$1' *= */, ""); sub (/\\$/, ""); gsub ( /[ \t]+/, "\n"); \ sub(/^#.*/ ,""); gsub (/@.*@/, ""); sub (/^/, header); \ print $0;}' > $2.tmp cat $2.tmp | sort | uniq > $2 # rm $2.tmp } function find_in_configure_tgt { echo "Looking for $1 in configure.tgt" echo configure.tgt | xargs -n 1 gawk ' /'$1' *=/, ! /\\$/ { \ if ($0 ~ /'$1' *=/) { \ header = gensub (/(^.*'$1'[^ \t]*)[ \t]*=.*/, \ "# \\1 found in " FILENAME ":" FNR "\n", 1); \ } else { header = "" } \ sub (/.*'$1' *= */, ""); sub(/\${[^{}]*}/, ""); sub (/\\$/, ""); \ gsub ( /[ \t]+/, "\n"); sub(/^#.*/ ,""); gsub (/"/, ""); \ sub (/^/, header); \ print $0;}' > $2.tmp cat $2.tmp | sort | uniq > $2 # rm $2.tmp } function find_in_configure_host { echo "Looking for $1 in configure.host" echo configure.host | xargs -n 1 gawk ' /'$1'/, ! /\\$/ { \ if ($0 ~ /'$1'/) { \ header = gensub (/(^.*'$1'[^ \t]*)[ \t]*=.*/, \ "# \\1 found in " FILENAME ":" FNR "\n", 1); \ } else { header = "" } \ sub (/^.*'$1' *= */, ""); sub (/\\$/, ""); gsub ( /[ \t]+/, "\n"); \ sub(/^#.*/ ,""); gsub (/"/, ""); sub (/^/, header); \ print $0;}' > $2.tmp cat $2.tmp | sort | uniq > $2 # rm $2.tmp } function remove_lines { echo "Removing files in $1 from $2" echo "# sed script to remove files listing in $1 from $2" > $1.sed # First remove comments sed -e "/^#/d" $1 > $1.strip for f in `cat $1.strip` ; do # echo "Removing $f from $2" echo "/${f//\//\\/}/d" >> $1.sed done linecount_before=`wc -l $2` sed -f $1.sed -i $2 linecount_after=`wc -l $2` echo "Number of files now: $linecount_after, before $linecount_before" } function test_files_exist { echo "Testing files in $1" # Strip comments sed -e "/^#/d" $1 > $1.strip for f in `cat $1.strip` ; do if [ $debug ] ; then echo "Testing file \"$f\"" fi if [ -f $f ]; then if [ $debug ] ; then echo "OK" fi else echo "File \"$f\" is not present" fi done } # Parameter 1: directory # Paremeter 2: extension # Parameter 3: destination file function list_files { find "$1" \ -name testsuite -prune -o \ -name features -prune -o \ -name gdbserver -prune -o \ -name gnulib -prune -o \ -name gdbtk -prune -o \ -name '*-stub.c' -prune -o \ -name '*-exp.c' -prune -o \ -type f -name '*.'$2 -print | sort | sed "s:^./::" > $3 } find_in_config_dir NATDEPFILES ${list}-nat-objs sed "s:\.o$:.c:g" ${list}-nat-objs > ${list}-nat find_in_config_dir NAT_GENERATED_FILES ${list}-nat-gen # We need to remove those from ${list}-nat remove_lines ${list}-nat-gen ${list}-nat # List native headers find_nat_headers NAT_FILE ${list}-nat-headers find_in_config_dir MH_CFLAGS ${list}-nat-cflags find_nat_defines define ${list}-nat-headers ${list}-nat-defines find_nat_defines undef ${list}-nat-headers ${list}-nat-undef find_in_makefile_in SFILES ${list}-sfiles find_in_makefile_in ALLDEPFILES ${list}-tdeps find_in_makefile_in SRCS ${list}-srcs find_in_makefile_in HFILES_NO_SRCDIR ${list}-headers find_in_configure_tgt gdb_target_obs ${list}-tgt-objs sed "s:\.o$:.c:g" ${list}-tgt-objs > ${list}-tgt-srcs find_in_configure_host gdb_host_obs ${list}-host-objs sed "s:\.o$:.c:g" ${list}-host-objs > ${list}-host-srcs test_files_exist ${list}-nat test_files_exist ${list}-sfiles test_files_exist ${list}-srcs test_files_exist ${list}-tgt-srcs test_files_exist ${list}-host-srcs test_files_exist ${list}-headers test_files_exist ${list}-tdeps cat ${list}-tgt-srcs > ${list}-all-shared.tmp # ALLDEPFILES also lists lots of native files :( # cat ${list}-tdeps >> ${list}-all-shared.tmp cat ${list}-all-shared.tmp | sort | uniq > ${list}-all-shared list_files . h ${list}-all-headers list_files . '[cy]' ${list}-all-c-srcs cp -f ${list}-all-c-srcs ${list}-c-srcs cp -f ${list}-all-headers ${list}-h-srcs remove_lines ${list}-headers ${list}-h-srcs remove_lines ${list}-nat ${list}-c-srcs remove_lines ${list}-sfiles ${list}-c-srcs remove_lines ${list}-tdeps ${list}-c-srcs remove_lines ${list}-srcs ${list}-c-srcs remove_lines ${list}-tgt-srcs ${list}-c-srcs remove_lines ${list}-host-srcs ${list}-c-srcs echo "Number of C or Y files not in any of the above lists:\ `wc -l ${list}-c-srcs`" cat ${list}-c-srcs echo "Number of header files not in any of the above lists:\ `wc -l ${list}-h-srcs`" cat ${list}-h-srcs find_nat_defines_uses ${list}-nat-defines ${list}-all-shared \ ${list}-shared-define-uses cat ${list}-shared-define-uses find_nat_defines_uses ${list}-nat-undef ${list}-all-shared \ ${list}-shared-undef-uses cat ${list}-shared-undef-uses find_nat_defines_uses ${list}-nat-defines ${list}-all-c-srcs \ ${list}-all-define-uses cat ${list}-all-define-uses find_nat_defines_uses ${list}-nat-undef ${list}-all-c-srcs \ ${list}-all-undef-uses cat ${list}-all-undef-uses