summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/var.c
Commit message (Collapse)AuthorAgeFilesLines
* make: report :M or :N pattern in debug modeavg2012-10-061-0/+1
| | | | MFC after: 12 days
* In usr.bin/make/var.c, function ParseModifier(), initialize the 'error'dim2012-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | variable to NULL, to avoid using it uninitialized in certain cases. This fixes the following clang 3.2 warning: usr.bin/make/var.c:1770:10: error: variable 'error' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (vp->execute) { ^~~~~~~~~~~ usr.bin/make/var.c:1777:10: note: uninitialized use occurs here if (error) ^~~~~ usr.bin/make/var.c:1770:6: note: remove the 'if' if its condition is always true if (vp->execute) { ^~~~~~~~~~~~~~~~~ usr.bin/make/var.c:1768:23: note: initialize the variable 'error' to silence this warning const char *error; ^ = NULL MFC after: 1 week
* Add "-V '${VAR}'" variable expansion from Portable Berkeley Make.obrien2012-05-311-5/+9
| | | | Submitted by: Simon Gerraty <sjg@juniper.net>
* Deprecate the FreeBSD make's ":U" (to-upper case) and ":L" (to-lower case)obrien2012-05-301-0/+15
| | | | | | | modifiers for ":tu" and ":tl" from OSF's ODE, which made its way into NetBSD's make, which is the source for the Portable Berkeley Make. Submitted by: Simon Gerraty <sjg@juniper.net>
* Spelling fixes for usr.bin/uqs2011-12-301-1/+1
|
* Remove unnecessary includes.delphij2009-12-111-2/+0
| | | | Reviewed by: rodrigc
* Note that r186713 also contained a change to VarAdd where we propagate theobrien2009-01-061-2/+1
| | | | | newly created 'Var' back to the caller. Also, back out an accidentally commented WIP comment.
* + Add the -Q be-quiet flag for parallel jobs.obrien2009-01-031-21/+16
| | | | | - Enable -Q by default for the moment - there is something weird going on in the rescue build.
* VarAdd() already does the debug printing, so Var_Set() only needs to do itobrien2006-07-171-2/+1
| | | | in the case the var already exists.
* Update comment about var modifiers (add 'N' and 'O' descriptions).fjoe2006-04-081-2/+5
|
* Add :u var modifier (remove adjacent duplicate words like uniq(1).fjoe2006-04-081-0/+40
| | | | | Reviewed by: harti Obtained from: NetBSD (mostly)
* - match_var: do not address memory at invalid address (`len' can be greaterfjoe2005-11-301-1/+1
| | | | | | | | | than strlen(var) + 1) - ReadMakeFile: prevent `fname' memory leak - ReadMakeFile: prevent double free (caused by double fclose) -- ParsePopInput() closes input file Reviewed by: harti
* The caller of Var_Value() should not change the variable value. Makeharti2005-05-241-4/+5
| | | | | | this clear by constifying the return value. Obtained from: DragonFlyBSD
* Get rid of the third argument to Var_Value() the pointer it pointedharti2005-05-241-14/+7
| | | | | | to has always been set to NULL for some time now. Obtained from: DragonFlyBSD
* Get rid of global variables for argument vectors produced by brk_string()harti2005-05-181-24/+22
| | | | | | | | introduce a struct that holds all the information about an argument vector and pass that around. Author: Max Okumoto <okumoto@ucsd.edu> Obtained from: DragonFlyBSD
* Replace a lot of Var_Set(..., VAR_GLOBAL) by Var_SetGlobal().harti2005-05-121-0/+11
| | | | Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.237)
* Move variable printing from main.c to var.charti2005-05-121-0/+34
| | | | Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.233)
* Move some global variables to the correct files.harti2005-05-121-3/+6
| | | | Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.232)
* Move the remaining two prototypes from nonints.h to make.h andharti2005-05-101-1/+0
| | | | | | | remove nonints.h. Patch: 7.204 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Move Cmd_Exec() from main.c to job.c and fix its prototype. Thisharti2005-05-101-0/+1
| | | | | | | results in a warning that will go away soon. Patch: 7.198 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Var_SubstOnly() is only used to subsitute a variable from the globalharti2005-05-101-1/+2
| | | | | | | | context (and only in one place to substitute the .for variable). Therefor there is no need to pass the context as a parameter. Patch: 7.197 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Clean up comments. No code changes.harti2005-05-101-194/+128
| | | | | Patch: 7.195 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Merge var_modify.c into var.c and move types and function declarationsharti2005-05-101-56/+601
| | | | | | | that are now used only in var.c from var.h to var.c Patches: 7.193,7.194 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Move some debugging code from targ.c to var.c where it actually belongs.harti2005-05-101-4/+12
| | | | | Patch: 7.192 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Make make a little bit more POSIXish with regard to option parsing:harti2005-05-101-8/+45
| | | | | | | | | | | | | | | take everything after -- as either a macro assignment or a target. Note that make still reorders arguments before --: anything starting with a dash is considered an option, anything which contains an equal sign is considered a macro assignment and everything else a target. This still is not POSIX with regard to the options, but it will probably not change because it has been make's behaviour for ages. Add a new function Var_Match() that correctly skips a macro call by just doing the same as Var_Subst() but without producing output. This will help making the parser more robust. Patches: 7.190,7.191 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Split Var_Subst() into two functions: Var_SubstOnly() which substitutesharti2005-05-091-140/+152
| | | | | | | | | | only one variable and Var_Subst() which substitutes all. Split out the test whether a variable should not be expanded into match_var(). Make access to the input string consistently using str[]. Remove two unused functions: Var_GetTail() and Var_GetHead(). Patches: 7.184-7.189 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Introduce a new pseudo-target .EXPORTVAR which allows to put aharti2005-05-061-65/+81
| | | | | | | | | | | | | | | | | | make macro into the environment of programs executed by make. This has approximately the same function as gmake's export directive. The form of a pseudo target was deliberately choosen to minimize work for POSIX compatibility (Makefiles are not allowed to use any targets starting with a dot and consisting only of uppercase letters except those specified in the standard when they want POSIX compatible behaviour, so such a Makefile can never contain .EXPORTVAR.) Change the handling of macros coming from the environment: instead of asking the environment for each variable we could not find otherwise put all the environment variables in a special variable environment just at start up. This has been tested on the ports cluster by kris. Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Split VarFind() into a series of functions tailored for the different setsharti2005-04-131-70/+94
| | | | | | | | | of flags originally passed to VarFind(). This eliminates the code by removing a bunch of tests. Patch: 7.173 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Fix a bug introduced in a previous commit: ParseModifier() consumesharti2005-03-301-15/+30
| | | | | | | | | | characters so it is not safe to move around code from before it to after it. This should fix problems with building the documentation. Patch: 7.170 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Remove the last two instances of Lst_Find() calls.harti2005-03-221-32/+31
|
* Use VarParse() inside var.c instead of Var_Parse().harti2005-03-221-20/+33
| | | | | | Patch: 7.163 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Unify callers to Var_Parse() with regard to variable names.harti2005-03-221-27/+26
| | | | | | Patch: 7.162 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Make some callers of VarFind using the same code structure.harti2005-03-221-28/+33
| | | | | | Patch: 7.161 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* De-lispify some if()-expressions by removing extra parantheses.harti2005-03-221-14/+14
| | | | | | | Patch: 7.160 Requested by: harti Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Return a Buf object from VarGetPattern() instead of a char * and a size_t.harti2005-03-221-20/+12
| | | | | | | | Store a Buf object in struct VarPattern instead of a char * and a length. Patch: 7.158 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Use the struct VarPattern's lhs field instead of using an extra variableharti2005-03-221-6/+5
| | | | | | | | to store the left expression of a C modificator. Patch: 7.157 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Merge struct VarREPattern into struct VarPattern. This will help sortingharti2005-03-221-5/+5
| | | | | | | | out common code. Patch: 7.156 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Delete an extra empty line.harti2005-03-221-1/+1
| | | | | | Patch: 7.153 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Simplify buffer access by using Buf_Data() and Buf_Peel() whereharti2005-03-221-33/+14
| | | | | | | | appropriate. Patch: 7.147-7.151 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Remove a temporary variable. Rename pattern to patt to be consistent.harti2005-03-221-216/+92
| | | | | | | | | Remove unreachable code for VAR_NOSUBST - it was never set. Replace redundant code with calls to VarGetPattern(). Patch: 7.143-7.145 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Remove unneeded temporary variables in modifier_S() and modifier_C().harti2005-03-211-69/+63
| | | | | | | | | Change the parsing of the C modifier flags so that specifying both '1' and 'g' gives an error. Patch: 7.141,7.142 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Remove comment about Var_Parse assuming that the first characterharti2005-03-211-58/+28
| | | | | | | | | | | | | is always a '$'. This is not always correct, for example for conditionals: .if defined(foobar). Clean up some comments. Move common code out of if-statements. Patch: 7.140 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Split out SysV variable substitution into its own function.harti2005-03-211-228/+151
| | | | | | Patch: 7.139 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Rename freePtr to freeResult to make it more obvious about whatharti2005-03-211-30/+30
| | | | | | | | pointer we're talking. Patch: 7.138 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Move some code from ParseModifier() into the calling function toharti2005-03-211-62/+46
| | | | | | | | simplify things. Correct a number comments. Patch: 7.137 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Cleanup the VAR_JUNK handling.harti2005-03-211-44/+42
| | | | | | Patch: 7.136 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Don't pass 'consumed' through all the parsing routines where it can be computedharti2005-03-211-131/+102
| | | | | | | | | | | by the caller. Don't pass 'endc' - it can be computed from 'startc'. Remove unneccessary temporary variables. Remove constant if-expressions and remove code before call Fatal() - there is no point to cleanup before aborting. Patch: 7.134,7.135 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Change one occurence of 'delim' to the correct type. Delete anotherharti2005-03-211-37/+29
| | | | | | | | | occurence which actually holds always the same constant value. Shorten the name pattern to patt. Patch: 7.133 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Reduce number of parameters passed between the parsing routinesharti2005-03-211-71/+58
| | | | | | | | | by putting them into struct VarParser or computing them (consumed). Change the loop termination condition in VarParseLong from endc to \0. Patch: 7.128-7.132 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Reduce the number of explicit parameters passed to VarParse()harti2005-03-211-11/+18
| | | | | | | | by passing them through struct VarParser. Patch: 7.127 Submitted by: Max Okumoto <okumoto@ucsd.edu>
OpenPOWER on IntegriCloud