Hi, [08:07] <@particle> hrmm i think i have splint on my laptop [08:08] <@particle> so i can probably test it on win32/msvc [09:10] <@particle> the splint target uses sed? oh, we've got some work do do [09:14] < Infinoid> I've been using a little perlscript to remove source filenames from the list that exist in a blacklist file, just to get splint to limp along well enough to give me a warning summary [09:15] <@particle> well, i need to convert that sed to perl, so it'll work portably [09:16] < Infinoid> that's a good idea [09:17] <@particle> it's using `echo ...` too, that'll have to go
...And the famous last words: [09:18] < Infinoid> if you have more important things to work on, I'm happy to do this cleanup, but it'll have to wait until I get off of work tonight :) So, I worked on the splint Makefile rules tonight. I only speak GNU make, so I'm not really sure which parts are portable and which parts aren't, so I'm kind of stabbing blindly in the dark and hoping for some feedback if I've gotten something wrong. There are a few problems I tried to fix: 1. Presumably non-portable shell escapes 2. Usage of awk, which might not exist on the target machine 3. Presumably the "lint" target should be updated to test the same sources as "splint" 4. These targets should depend on sources existing, they do not depend on the $(PARROT) binary I'm not really sure whether shell escapes are allowed with non-GNU make, so I actually rolled two patches: one with shell escapes, one without. The non-shell-escapes version should be more portable, but it's more intrusive, thus a bigger, uglier patch, and more maintenance overhead. Basically, the strategy for this one is to maintain a list of C sources alongside the object lists. So the static lists have become two lists, and the autogenerated stuff ends up generating two sets of filenames. See attached splint_sources_list_try1.diff. However, if $(shell foo) is portable, this change gets easier: just do a search & replace, to change the .o extension (except that we ought to use $(O) instead) into a .c extension. But I did it with perl this time, because we know that's already installed. (At least, I don't think you can configure Parrot without it.) See attached splint_sources_list_try2.diff. Finally, I changed the splint:, splint2: and lint: rules to use the lists. Previously, the lint rule just ran on "src/*.c", and splint/splint2 did an ugly `echo $(O_FILES) | sed ...` type of thing. And presumably you'd want to run lint on the same list of sources splint gets run on. (I don't actually have a lint command, but it seems logical to me.) I should mention I initially considered using Parrot::Distribution->get_c_language_files(), but that also returned C sources for platforms other than my own, and splint broke when trying to read a darwin-specific file, which couldn't find its header files on my linux box. So the goal here was to obtain a list of sources which are actually relevant for the current build environment. Anyway, if either of these patches seem useful, please apply whichever one seems more sensible. Mark
=== config/auto/cgoto.pm ================================================================== --- config/auto/cgoto.pm (revision 20103) +++ config/auto/cgoto.pm (local) @@ -47,7 +47,8 @@ if ($test) { $conf->data->set( TEMP_cg_h => '$(INC_DIR)/oplib/core_ops_cg.h $(INC_DIR)/oplib/core_ops_cgp.h', - TEMP_cg_c => <<'EOF', + TEMP_cg_c => '$(OPS_DIR)/core_ops_cg.c $(OPS_DIR)/core_ops_cgp.c', # runops_cores.c is apparently not built at the moment + TEMP_cg_compile => <<'EOF', # generated by config/auto/cgoto.pm $(OPS_DIR)/core_ops_cg$(O): $(GENERAL_H_FILES) $(OPS_DIR)/core_ops_cg.c === config/auto/gc.pm ================================================================== --- config/auto/gc.pm (revision 20103) +++ config/auto/gc.pm (local) @@ -90,19 +90,21 @@ if ( $gc =~ /^malloc(?:-trace)?$/ ) { $conf->data->set( - TEMP_gc_c => <<"EOF", + TEMP_gc_compile => <<"EOF", \$(SRC_DIR)/$gc\$(O): \$(GENERAL_H_FILES) \$(SRC_DIR)/$gc.c \$(SRC_DIR)/res_lea\$(O): \$(GENERAL_H_FILES) \$(SRC_DIR)/res_lea.c EOF + TEMP_gc_c => "\$(SRC_DIR)\/$gc.c \$(SRC_DIR)/res_lea.c", TEMP_gc_o => "\$(SRC_DIR)\/$gc\$(O) \$(SRC_DIR)/res_lea\$(O)", gc_flag => '-DGC_IS_MALLOC', ); } elsif ( $gc eq 'libc' ) { $conf->data->set( - TEMP_gc_c => <<"EOF", + TEMP_gc_compile => <<"EOF", \$(SRC_DIR)/gc/res_lea\$(O): \$(GENERAL_H_FILES) \$(SRC_DIR)/gc/res_lea.c EOF + TEMP_gc_c => "\$(SRC_DIR)/gc/res_lea.c", TEMP_gc_o => "\$(SRC_DIR)/gc/res_lea\$(O)", gc_flag => '-DGC_IS_MALLOC', ); @@ -110,9 +112,10 @@ else { $gc = 'gc'; $conf->data->set( - TEMP_gc_c => <<"EOF", + TEMP_gc_compile => <<"EOF", \$(SRC_DIR)/gc/resources\$(O): \$(GENERAL_H_FILES) \$(SRC_DIR)/gc/resources.c EOF + TEMP_gc_c => "\$(SRC_DIR)/gc/resources.c", TEMP_gc_o => "\$(SRC_DIR)/gc/resources\$(O)", gc_flag => '', ); === config/auto/jit.pm ================================================================== --- config/auto/jit.pm (revision 20103) +++ config/auto/jit.pm (local) @@ -127,6 +127,8 @@ jitosname => uc($jitosname), jitcapable => 1, cc_hasjit => " -DHAS_JIT -D\U$jitcpuarch", + TEMP_jit_c => +'$(SRC_DIR)/jit.c $(SRC_DIR)/jit_cpu.c $(SRC_DIR)/jit_debug.c $(SRC_DIR)/jit_debug_xcoff.c', TEMP_jit_o => '$(SRC_DIR)/jit$(O) $(SRC_DIR)/jit_cpu$(O) $(SRC_DIR)/jit_debug$(O) $(SRC_DIR)/jit_debug_xcoff$(O)' ); @@ -152,6 +154,8 @@ $conf->data->set( TEMP_exec_h => '$(SRC_DIR)/jit.h $(INC_DIR)/exec.h $(SRC_DIR)/exec_dep.h $(SRC_DIR)/exec_save.h', + TEMP_exec_c => + '$(SRC_DIR)/exec.c $(SRC_DIR)/exec_cpu.c $(SRC_DIR)/exec_save.c', TEMP_exec_o => '$(SRC_DIR)/exec$(O) $(SRC_DIR)/exec_cpu$(O) $(SRC_DIR)/exec_save$(O)', execcapable => 1 @@ -160,6 +164,7 @@ else { $conf->data->set( TEMP_exec_h => '', + TEMP_exec_c => '', TEMP_exec_o => '', execcapable => 0 ); @@ -208,6 +213,7 @@ cc_hasjit => '', TEMP_jit_o => '', TEMP_exec_h => '', + TEMP_exec_c => '', TEMP_exec_o => '' ); } === config/inter/charset.pm ================================================================== --- config/inter/charset.pm (revision 20103) +++ config/inter/charset.pm (local) @@ -49,6 +49,7 @@ } # names of class files for src/pmc/Makefile + my $TEMP_charset_c = $charset_list; ( my $TEMP_charset_o = $charset_list ) =~ s/\.c/\$(O)/g; my $TEMP_charset_build = <<"E_NOTE"; @@ -68,10 +69,12 @@ # build list of libraries for link line in Makefile my $slash = $conf->data->get('slash'); + $TEMP_charset_c =~ s/^| / src${slash}charset${slash}/g; $TEMP_charset_o =~ s/^| / src${slash}charset${slash}/g; $conf->data->set( charset => $charset_list, + TEMP_charset_c => $TEMP_charset_c, TEMP_charset_o => $TEMP_charset_o, TEMP_charset_build => $TEMP_charset_build, ); === config/inter/encoding.pm ================================================================== --- config/inter/encoding.pm (revision 20103) +++ config/inter/encoding.pm (local) @@ -49,8 +49,9 @@ } # names of class files for src/pmc/Makefile + my $TEMP_encoding_c = $encoding_list; ( my $TEMP_encoding_o = $encoding_list ) =~ s/\.c/\$(O)/g; - + my $TEMP_encoding_build = <<"E_NOTE"; # the following part of the Makefile was built by 'config/inter/encoding.pm' @@ -69,9 +70,11 @@ # build list of libraries for link line in Makefile my $slash = $conf->data->get('slash'); $TEMP_encoding_o =~ s/^| / src${slash}encodings${slash}/g; + $TEMP_encoding_c =~ s/^| / src${slash}encodings${slash}/g; $conf->data->set( encoding => $encoding_list, + TEMP_encoding_c => $TEMP_encoding_c, TEMP_encoding_o => $TEMP_encoding_o, TEMP_encoding_build => $TEMP_encoding_build, ); === config/inter/pmc.pm ================================================================== --- config/inter/pmc.pm (revision 20103) +++ config/inter/pmc.pm (local) @@ -122,6 +122,7 @@ # so there would be tests needed, that check for vital classes # names of class files for src/pmc/Makefile + ( my $TEMP_pmc_c = $pmc_list ) =~ s/\.pmc/\.c/g; ( my $TEMP_pmc_o = $pmc_list ) =~ s/\.pmc/\$(O)/g; ( my $TEMP_pmc_str = $pmc_list ) =~ s/\.pmc/\.str/g; @@ -169,6 +170,7 @@ # build list of libraries for link line in Makefile my $slash = $conf->data->get('slash'); + ( my $TEMP_pmc_classes_c = $TEMP_pmc_c ) =~ s/^| / src${slash}pmc${slash}/g; ( my $TEMP_pmc_classes_o = $TEMP_pmc_o ) =~ s/^| / src${slash}pmc${slash}/g; ( my $TEMP_pmc_classes_str = $TEMP_pmc_str ) =~ s/^| / src${slash}pmc${slash}/g; ( my $TEMP_pmc_classes_pmc = $pmc_list ) =~ s/^| / src${slash}pmc${slash}/g; @@ -208,6 +210,7 @@ pmc_names => join( " ", @names ), TEMP_pmc_o => $TEMP_pmc_o, TEMP_pmc_build => $TEMP_pmc_build, + TEMP_pmc_classes_c => $TEMP_pmc_classes_c, TEMP_pmc_classes_o => $TEMP_pmc_classes_o, TEMP_pmc_classes_str => $TEMP_pmc_classes_str, TEMP_pmc_classes_pmc => $TEMP_pmc_classes_pmc, === config/gen/makefiles/root.in ================================================================== --- config/gen/makefiles/root.in (revision 20103) +++ config/gen/makefiles/root.in (local) @@ -367,6 +367,21 @@ $(IMCC_DIR)/parser.h \ $(IMCC_DIR)/imcparser.h +IMCC_C_FILES = \ + $(IMCC_DIR)/imcparser.c \ + $(IMCC_DIR)/imclexer.c \ + $(IMCC_DIR)/imc.c \ + $(IMCC_DIR)/symreg.c \ + $(IMCC_DIR)/instructions.c \ + $(IMCC_DIR)/cfg.c \ + $(IMCC_DIR)/reg_alloc.c \ + $(IMCC_DIR)/sets.c \ + $(IMCC_DIR)/debug.c \ + $(IMCC_DIR)/optimizer.c \ + $(IMCC_DIR)/pbc.c \ + $(IMCC_DIR)/parser_util.c \ + $(IMCC_DIR)/pcc.c + IMCC_O_FILES = \ $(IMCC_DIR)/imcparser$(O) \ $(IMCC_DIR)/imclexer$(O) \ @@ -388,12 +403,27 @@ ALL_H_FILES = $(GENERAL_H_FILES) CHARSET_O_FILES = @TEMP_charset_o@ +CHARSET_C_FILES = @TEMP_charset_c@ CLASS_PMC_FILES = @TEMP_pmc_classes_pmc@ CLASS_O_FILES = @TEMP_pmc_classes_o@ +CLASS_C_FILES = @TEMP_pmc_classes_c@ CLASS_STR_FILES = @TEMP_pmc_classes_str@ ENCODING_O_FILES = @TEMP_encoding_o@ +ENCODING_C_FILES = @TEMP_encoding_c@ +IO_C_FILES = \ + $(IO_DIR)/io.c \ + $(IO_DIR)/io_buf.c \ + $(IO_DIR)/io_layers.c \ + $(IO_DIR)/io_unix.c \ + $(IO_DIR)/io_utf8.c \ + $(IO_DIR)/io_mmap.c \ + $(IO_DIR)/io_win32.c \ + $(IO_DIR)/io_stdio.c \ + $(IO_DIR)/io_string.c \ + $(IO_DIR)/io_passdown.c + IO_O_FILES = \ $(IO_DIR)/io$(O) \ $(IO_DIR)/io_buf$(O) \ @@ -406,6 +436,82 @@ $(IO_DIR)/io_string$(O) \ $(IO_DIR)/io_passdown$(O) +INTERP_C_FILES = \ + $(OPS_DIR)/core_ops.c \ + $(OPS_DIR)/core_ops_switch.c \ + @TEMP_cg_c@ \ + @TEMP_exec_c@ \ + $(SRC_DIR)/charset.c \ + $(SRC_DIR)/encoding.c \ + $(SRC_DIR)/exceptions.c \ + $(SRC_DIR)/global_setup.c \ + $(SRC_DIR)/interpreter.c \ + $(SRC_DIR)/inter_call.c \ + $(SRC_DIR)/inter_cb.c \ + $(SRC_DIR)/inter_create.c \ + $(SRC_DIR)/inter_misc.c \ + $(SRC_DIR)/inter_run.c \ + $(SRC_DIR)/gc/register.c \ + $(SRC_DIR)/gc/memory.c \ + $(SRC_DIR)/objects.c \ + $(SRC_DIR)/packfile.c \ + $(SRC_DIR)/stacks.c \ + $(SRC_DIR)/stack_common.c \ + $(SRC_DIR)/string.c \ + $(SRC_DIR)/string_primitives.c \ + $(SRC_DIR)/sub.c \ + $(SRC_DIR)/runops_cores.c \ + $(SRC_DIR)/trace.c \ + $(SRC_DIR)/pmc.c \ + $(SRC_DIR)/pmc_freeze.c \ + $(SRC_DIR)/key.c \ + $(SRC_DIR)/hash.c \ + $(SRC_DIR)/core_pmcs.c \ +#CONDITIONED_LINE(platform_asm): $(SRC_DIR)/platform_asm.c \ + $(SRC_DIR)/platform.c \ + @TEMP_jit_c@ \ + $(SRC_DIR)/intlist.c \ + $(SRC_DIR)/list.c \ + $(SRC_DIR)/library.c \ + $(SRC_DIR)/global.c \ + $(SRC_DIR)/embed.c \ + $(SRC_DIR)/warnings.c \ + $(SRC_DIR)/packout.c \ + $(SRC_DIR)/byteorder.c \ + $(SRC_DIR)/debug.c \ + $(SRC_DIR)/headers.c \ + $(SRC_DIR)/hll.c \ + $(SRC_DIR)/gc/smallobject.c \ + $(SRC_DIR)/gc/dod.c \ + $(SRC_DIR)/gc/gc_ims.c \ + $(SRC_DIR)/gc/gc_gms.c \ + $(SRC_DIR)/exit.c \ + $(SRC_DIR)/misc.c \ + $(SRC_DIR)/spf_render.c \ + $(SRC_DIR)/spf_vtable.c \ + $(SRC_DIR)/datatypes.c \ + $(SRC_DIR)/fingerprint.c \ + $(SRC_DIR)/nci.c \ + $(SRC_DIR)/cpu_dep.c \ + $(SRC_DIR)/tsq.c \ + $(SRC_DIR)/longopt.c \ + $(SRC_DIR)/events.c \ + $(SRC_DIR)/thread.c \ + $(SRC_DIR)/dynext.c \ + $(SRC_DIR)/utils.c \ + $(SRC_DIR)/vtables.c \ + $(SRC_DIR)/pic.c \ + $(SRC_DIR)/pic_jit.c \ + $(SRC_DIR)/mmd.c \ + $(SRC_DIR)/builtin.c \ + $(SRC_DIR)/extend.c \ + $(SRC_DIR)/extend_vtable.c \ + $(SRC_DIR)/revision.c \ + $(PF_DIR)/pf_items.c \ + $(SRC_DIR)/stm/backend.c \ + $(SRC_DIR)/stm/waitlist.c \ + @TEMP_gc_c@ + INTERP_O_FILES = \ $(OPS_DIR)/core_ops$(O) \ $(OPS_DIR)/core_ops_switch$(O) \ @@ -484,6 +590,14 @@ $(SRC_DIR)/stm/waitlist$(O) \ @TEMP_gc_o@ +C_FILES = \ + $(INTERP_C_FILES) \ + $(CHARSET_C_FILES) \ + $(IO_C_FILES) \ + $(CLASS_C_FILES) \ + $(ENCODING_C_FILES) \ + $(IMCC_C_FILES) + O_FILES = \ $(INTERP_O_FILES) \ $(CHARSET_O_FILES) \ @@ -1159,9 +1273,9 @@ $(OPS_DIR)/core_ops_switch.c : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2c.pl lib/Parrot/OpsFile.pm lib/Parrot/Op.pm $(INC_DIR)/config.h lib/Parrot/OpLib/core.pm lib/Parrot/OpTrans/CSwitch.pm lib/Parrot/OpTrans/CPrederef.pm $(PERL) $(BUILD_TOOLS_DIR)/ops2c.pl CSwitch --core [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ @TEMP_pmc_build@ @@ -1696,16 +1810,17 @@ svn diff -lint : $(PARROT) +lint : $(C_FILES) rm -f *.ln - $(LINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" $(LINTFLAGS) src/*.c + $(LINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" "-Icompilers/ast" $(LINTFLAGS) $(C_FILES) + $(LINT) $(CC_INC) $(LINTFLAGS) $(IMCC_DIR)/main.c -splint : $(PARROT) - $(SPLINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" "-Icompilers/ast" $(SPLINTFLAGS) $(SPLINTOPTS) `echo $(O_FILES) | sed @[EMAIL PROTECTED]/\.o/\.c/[EMAIL PROTECTED]@` +splint : $(C_FILES) + $(SPLINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" "-Icompilers/ast" $(SPLINTFLAGS) $(SPLINTOPTS) $(C_FILES) $(SPLINT) $(CC_INC) $(SPLINTFLAGS) $(SPLINTOPTS) $(IMCC_DIR)/main.c -splint2 : $(PARROT) - $(SPLINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" "-Icompilers/ast" $(SPLINTFLAGS2) $(SPLINTOPTS) `echo $(O_FILES) | sed @[EMAIL PROTECTED]/\.o/\.c/[EMAIL PROTECTED]@` +splint2 : $(C_FILES) + $(SPLINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" "-Icompilers/ast" $(SPLINTFLAGS2) $(SPLINTOPTS) $(C_FILES) $(SPLINT) $(CC_INC) $(SPLINTFLAGS2) $(SPLINTOPTS) $(IMCC_DIR)/main.c
=== config/gen/makefiles/root.in ================================================================== --- config/gen/makefiles/root.in (revision 20103) +++ config/gen/makefiles/root.in (local) @@ -492,6 +492,8 @@ $(ENCODING_O_FILES) \ $(IMCC_O_FILES) +C_FILES = $(shell perl -e 'foreach $$_ (@ARGV) { s/$(O)$$/.c/; print("$$_\n") }' $(O_FILES)) + OPS_FILES = @ops@ $(GEN_OPSFILES) ############################################################################### @@ -1696,16 +1698,17 @@ svn diff -lint : $(PARROT) +lint : $(C_FILES) rm -f *.ln - $(LINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" $(LINTFLAGS) src/*.c + $(LINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" "-Icompilers/ast" $(LINTFLAGS) $(C_FILES) + $(LINT) $(CC_INC) $(LINTFLAGS) $(IMCC_DIR)/main.c -splint : $(PARROT) - $(SPLINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" "-Icompilers/ast" $(SPLINTFLAGS) $(SPLINTOPTS) `echo $(O_FILES) | sed @[EMAIL PROTECTED]/\.o/\.c/[EMAIL PROTECTED]@` +splint : $(C_FILES) + $(SPLINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" "-Icompilers/ast" $(SPLINTFLAGS) $(SPLINTOPTS) $(C_FILES) $(SPLINT) $(CC_INC) $(SPLINTFLAGS) $(SPLINTOPTS) $(IMCC_DIR)/main.c -splint2 : $(PARROT) - $(SPLINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" "-Icompilers/ast" $(SPLINTFLAGS2) $(SPLINTOPTS) `echo $(O_FILES) | sed @[EMAIL PROTECTED]/\.o/\.c/[EMAIL PROTECTED]@` +splint2 : $(C_FILES) + $(SPLINT) $(CC_INC) @cc_hasjit@ "-Isrc/pmc" "-Icompilers/ast" $(SPLINTFLAGS2) $(SPLINTOPTS) $(C_FILES) $(SPLINT) $(CC_INC) $(SPLINTFLAGS2) $(SPLINTOPTS) $(IMCC_DIR)/main.c