[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
.IGNORE: target doesn't work (with fix)
From: |
Mark Eichin |
Subject: |
.IGNORE: target doesn't work (with fix) |
Date: |
Thu, 15 Sep 2005 18:58:06 -0400 (EDT) |
I was trying to determine why this Makefile:
thing:
exit 1
.IGNORE: thing
all: thing
still fails, even with a fresh source build:
$ ./make -f /tmp/Makefile all
exit 1
make: *** [thing] Error 1
A bit of code diving turned up this obvious-looking bit of job.c, in
start_job_command:
p = child->command_ptr;
child->noerror = flags & COMMANDS_NOERROR;
Bracketing it with printfs told me that while (flags &
COMMANDS_NOERROR) was non-zero, child->noerror was zero on both sides.
But then I remembered that this is C, and not a high level
language...
(gdb) ptype child
type = struct child {
struct child *next;
struct file *file;
char **environment;
char **command_lines;
unsigned int command_line;
char *command_ptr;
pid_t pid;
char *sh_batch_file;
unsigned int remote : 1;
unsigned int noerror : 1;
unsigned int good_stdin : 1;
unsigned int deleted : 1;
} *
(gdb) p child->noerror = 4
warning: Value does not fit in 1 bits.
$3 = 0
(gdb) p child->noerror = 1
$4 = 1
There doesn't appear to be a gcc warning to cover this case (possibly
because any warning would explode on *all* arithmetic expressions
involving bitfields... though that might actually be beneficial :-)
The "obvious" if a bit ugly fix:
child->noerror = !!(flags & COMMANDS_NOERROR);
Works as expected, if you can stomach interpreting !! as a "cast to
boolean" idiom (this is the version I actually tested.)
child->noerror = (flags & COMMANDS_NOERROR)? 1 : 0;
might be clearer.
I've appended a "tests/scripts/features/ignore" script which is
basically a quick edit of tests/scripts/features/comments - it's not
quite right, but it's a starting point and might help figure out if
this feature ever worked :-) [As it is derived from the existing one,
I'm hoping you can just take it.]
Enjoy.
_Mark_ <address@hidden>
# start of ignore script
$description = "The following test creates a makefile to test .IGNORE\n";
$details = "Set up a rule that does an exit 1, then .IGNORE it.\n";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE <<\EOF;
thing:
exit 1
@echo There should be no errors for this makefile.
.IGNORE: thing
all: thing
EOF
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "There should be no errors for this makefile.\n";
# COMPARE RESULTS
&compare_output($answer,&get_logfile(1))
# end of script
- .IGNORE: target doesn't work (with fix),
Mark Eichin <=