Commit Graph

852 Commits

Author SHA1 Message Date
dsl b294f6c2a3 Fix sense of MAKE_NATICE test. 2009-01-24 23:19:50 +00:00
dsl 4802ea584f Add #ifndef MAKE_NATIVE around __RCSID 2009-01-24 23:07:48 +00:00
dsl 97347d2cbb Fixes to includes of make_malloc.h to that it actually builds when
USE_EMALLOC is undefined.
Fixes earlier fixes :-)
2009-01-24 14:43:28 +00:00
cegger 9fde1a673e buildfixes for OSX:
- include <sys/types> for size_t
- progname is undeclared
- include <string.h> for string functions like strlen()
- include <errno.h> for errno
2009-01-24 13:06:16 +00:00
wiz 6942778bea Sort sections. Fix typo (last line). 2009-01-24 13:02:33 +00:00
cegger e6227c556c buildfix: remove RCSID. It conflicts with the definition in the .c files. 2009-01-24 12:59:51 +00:00
dsl 4fb693c12c Move the bmake_malloc() functions into their own .c and .h files.
Include instead of make.h in a few places.
2009-01-24 11:59:39 +00:00
dsl 5d04927c08 Correct the definition of the :? modifier - in particular the modifier
applies to the variable name, not its value!
Remove the set of examples that were recently added that failed to
explain why some worked and some didn't.
Add a not to the compatability section about the change in .for loop
substitution post 5.0.
Add a BUGS section.
XXX the BUGS section needs more entries :-)
2009-01-24 11:56:41 +00:00
dsl a1e84ff783 Don't cast 'time_t' to 'void *' and back it will lose precision. 2009-01-24 10:59:09 +00:00
dsl 86df0d691f Sprinkle some const.
In particular for Lst_Find() and Lst_FindFrom().
Remove some unneeded casts and some now-undeeded UNCONST().
2009-01-23 21:58:27 +00:00
dsl 0cbb4ab551 Change 'ClientData' to 'void *' so that relevant parameters can
be made 'const void *'.
2009-01-23 21:26:30 +00:00
dsl d6c81d7cf1 There is no point in saving the last character of a NUL-terminated
string in order to overwrite with a NUL, then restore the original value!
Remove and simplify the CondDoFoo() functions.
2009-01-23 20:22:50 +00:00
dsl 60ec4ca26f Revert previous - cause grief with .ifdef (foo)
Instead return False for exists(), defined(), make() etc when the
argument has length zero.
2009-01-18 17:30:19 +00:00
dsl bae3fcc0c3 Only terminate a conditional function argument on ')' if we expect the
argument to be exclosed in (...).
'.if exists()' is parsed as '.ifdef exists()' and the ')' must not be
left over at the end.
I have no idea why any of my recent changes have affected this.
But pkgsrc/mk/compiler/gcc.mk (line 488) does .if exists(${FCPATH})
even though FCPATH is only set when the file exists.
2009-01-18 12:50:15 +00:00
lukem ab93b4bc61 fix -Wsign-compare issues 2009-01-18 01:31:12 +00:00
dsl 18e81da746 __predict_false() isn't defined if we aren't netbsd, stub out. 2009-01-17 13:55:42 +00:00
dsl 462d090d0f Change 'Buffer' so that it is the actual struct, not a pointer to it.
Saves having to malloc/free a fixed size structure.
Buf_Init() now takes ptr to Buffer to initialiase.
Change Buf_Destroy() to return ptr to string when not freed.
Remove large number of casts to (Byte) and (Byte *) - 'Byte' is 'char' here.
Buf_AddByte[s] guarantees that the data is 0 termininated, so never add '\0'.
Keep 'count' not 'left' and 'inPtr', code is simplier with only one update.
Fix fallou, no functional change.
2009-01-17 13:29:37 +00:00
dsl d020c6ab24 Allocate string vector in chunks, instead of calling realloc()
every time something is added.
2009-01-16 21:15:34 +00:00
dsl 74a68f7259 Debug print improvements. 2009-01-16 21:14:30 +00:00
dsl cd6806d831 Send output of Error() to debug_file (unless stderr/stdout). 2009-01-16 21:13:13 +00:00
dsl e9eac4d91e Parse_Error() really doesn't need to cruft up a dummy structure for curFile.
It only needs the 'fname' and 'lineno' fields - so just use NULL/0 when
curFile is NULL.
2009-01-16 20:50:24 +00:00
dsl ac3b504aef Contrary to my previous thoughts, .for loop variable values do contain
variable references - eg ${.TARGET} since that can't be expanded earlier.
Also the variable gets re-expanded before modifiers are applied.
All this means that we do need to let :U expand variables and must not
just escape $.
2009-01-14 22:54:10 +00:00
dsl be588a30bc When substituting .for control variables (as ${:U...}) escape '$' and '\'
as well as ':' and '}' or ')'.
The parameters have just been expanded (and will be expanded again) later
so don't need expanding as part of the :U process.
Seems to fix pkgsrc breakage at line 34 of bsd.pkginstall.mk doing:
.for i in ${PKG_USERS}
_PKG_VARS.pkginstall+=  PKG_UID.${u} PKG_GECOS.${u} PKG_HOME.${u} PKG_SHELL.${u}
.endfor
when PKG_USERS = ${AVAHI_USER}:${AVAHI_GROUP}::Avahi\ user:/nonexistent
(set at line 41 of the ahavi Makefile)
I really dont think the above has the desired effect!
2009-01-13 18:30:00 +00:00
dsl 54d6432069 Sprinkle a const. (arg of Main_ParseArgLine()) 2009-01-13 18:22:34 +00:00
dholland dbfa1570e7 Fix blatantly wrong exposition of .WAIT example.
PR bin/40372 from Gao Ya'nan.
2009-01-12 09:28:10 +00:00
dsl 40aa52653a Instead of stashing the body of every iteration of a .for loop, pass
Parse_SetInput() the name of a function to get the loop data blocks.
This should only be a change to the program logic.
2009-01-11 15:50:06 +00:00
dsl b19182e92b When substituting .for control variables any } or ) that matches the
${ or $( must be \ escaped.
Should fix some pkgsrc issues - eg 'clean' in print/gv.
2009-01-10 16:59:02 +00:00
dsl aba4927178 Allow the user to save an unsigned int (eg the length or flags) with
each string.
2009-01-10 16:55:39 +00:00
dsl a4f183d445 Fix PR bin/1443 properly!
Ignore '=' and ' ' inside {} and () when looking for an assignment operator.
Also require the operator be immediately after any whitespace.
XXX mismatched (){} in variable modifiers will not DTRT.
2009-01-08 21:12:09 +00:00
dsl 2aeb32481a Count () and {} when looking to the '=' that terminates the variable being
assigned to.
Should fix:  A.${B:S/=//} = c
2009-01-04 20:17:36 +00:00
dsl aee1343f51 In the :M code, 'pattern' is always malloced memory - so unconditionally
free.
2008-12-29 10:18:38 +00:00
dsl 1fc20cc6eb Count both () and {} when looking for the end of a :M pattern.
In particular inside .if empty(...) it was only counting ().
In reality this needs further changes.
This may well fix recent pkgsrc breakage.
2008-12-29 10:12:30 +00:00
christos 644d31b987 if mtime == 0, make it 1 because the code expects 0 time to mean that the
file does not exist
2008-12-28 18:32:54 +00:00
christos 266b18d880 prepare for time_t 64 2008-12-28 18:31:51 +00:00
dsl e4be9d4f2c Treat '\\' as a possible terminator for a loop control variable.
(Typically an escaped \: of a nested modifier.)
2008-12-23 21:56:38 +00:00
dsl 14bf83b326 Note that an unrecognised word in a .if is the same as in .ifdef and that
such a word has to be white-space separated.
From PR bin/30967 bin/37222 and maybe others!
2008-12-21 21:05:27 +00:00
dsl f2de2e5cbd Add some notes about recursive expansion and expansion of variable names.
Note that any of "${}()" in variable names will be griefsome!
Remove the example of using ::= to apply a modifier to a .for loop
variable as that is no longer necessary.
Remember to change the date :-)
2008-12-21 19:32:16 +00:00
dsl 6cb006c860 Only escape ':' in the outer level of .for variable substitution.
XXX: like elsewhere this code just counts {( against })
2008-12-21 19:19:55 +00:00
dsl c2cc9b5595 Change the way .for variables are substituted.
Instead of doing a full substitution giving plain text, just replace the
variable part with something that will expand to the required text - leaving
any modifiers for the later evaluation of the input line.
This stops .for being used as an 'eval' (previously you could generate .if etc)
and also means it is still a variable expansion - which some other parts need
to work in the expected fashion.
2008-12-21 18:06:53 +00:00
dsl d003f8f69b Don't allow $) $} $: or $$ as variable expansions, they confuse other
parts of make that try to scan through variable expansions.
  (given the make syntax that is all rather doomed anyway!)
Move the check for $\0 to a place where it will be detected - otherwise
  the parser will run off the input buffer!
2008-12-21 10:44:10 +00:00
dsl 899813caea Add functions for processing extendable arrays of pointers to strings.
Use for the .for variables and substution items - changing the latter from
make's all conquering lst.lib functions.
Being able to index everything makes the code simpler.
No functional changes intended.
2008-12-20 22:41:53 +00:00
dsl e06fc1c61f A lot of code assumes that the pointer returned by Buf_GetAll() is malloced.
Replace Buf_Discard() with Buf_Empty() since the former might leave the
'outPtr != buffer' and the only caller wanted all the data discared.
Remove 'outPtr' now that it always equals 'buffer'.
The assumption about Buf_GetAll()is now guaranteed by design.
2008-12-20 18:08:24 +00:00
dsl 0533dfcd70 Remove the definitions of NIL (now unused) and NULL (defined elsewhere). 2008-12-20 17:42:01 +00:00
dsl b1e9c7dca0 Set the .for loop control variables in reverse order to avoid faffing. 2008-12-20 17:38:37 +00:00
dsl 03a9360df5 Do not allow Var_Set() or Var_Append() to set the empty variable (which will
now forever remain undefined).
Rework/simplify code to avoid UNCONST().
2008-12-20 17:14:04 +00:00
dsl b7b48965cc Change some "^I *^I" to "^I^I" and align the comment block about
variable modifiers.
2008-12-20 16:03:59 +00:00
dsl 81b38761ef Delete very splurious 'free(buf)' that xtos added.
Fixes PR bin/40233
2008-12-20 09:42:02 +00:00
christos 6caebc4e79 PR/32154: Roland Illig: brk_string fails to report errors in unquoted strings. 2008-12-19 22:04:36 +00:00
christos cd056136e4 if brk_string fail, so do we. 2008-12-19 22:03:41 +00:00
christos 1a59b518a0 if brk_string failed, use the shell. 2008-12-19 22:01:19 +00:00