summaryrefslogtreecommitdiff
path: root/misc.c
AgeCommit message (Collapse)AuthorFilesLines
2013-11-23[SV 40361] Don't use vsnprintf(), which is an ISO C99 function.Paul Smith1-5/+5
* output.c (error, fatal, message): Take an extra argument specifying how many bytes are used by the formatted arguments. (get_buffer): New function that allocates the requested buffer size. Remove msc_vsnprintf(), vfmtconcat(), and fmtconcat() as unneeded. * makeint.h: Declare various helper macros for generating output. * *.c: Change all error(), fatal(), message() calls to use the macros, or pass the extra length argument directly.
2013-09-22Add VMS port updates from Hartmut Becker.Paul Smith1-0/+1
2013-09-14[SV 33134] Don't try to close stdout when it's already closed.Paul Smith1-47/+0
2013-09-14Support the -Orecurse option properly.Paul Smith1-95/+1
In this mode we still collect all the output from a given target and dump it at once. However we don't treat recursive lines any differently from non-recursive lines. Also we don't print enter/leave messages after every dump. However we do ensure that we always print them once to stdout, so the parent make will collect it properly.
2013-09-12Enhance the output sync mode.Paul Smith1-176/+1
Create a new file, output.c, and collect functions that generate output there. We introduce a new global context specifying where output should go (to stdout or to a sync file), and the lowest level output generator chooses where to write output based on that context. This allows us to set the context globally, and all operations that write output (including functions like $(info ...) etc.) will use it. Removed the "--trace=dir" capability. It was too confusing. If you have directory tracking enabled then output sync will print the enter/leave message for each synchronized block. If you don't want that, disable directory tracking.
2013-07-21[Bug #39158] Source cleanups suggested by cppcheck utility.Paul Smith1-5/+3
2013-06-28Set O_APPEND mode for stdout/stderr and output-sync temporary files.Paul Smith1-0/+20
POSIX does not guarantee that writes will be atomic if a file is opened for normal (non-append) output. That means if multiple processes are writing to the same file, output could be lost. I can't think of a real use-case where we would NOT want append for stdout/stderr, so force it if we can.
2013-06-22Create a character map to use for locating stop-points in strings.Paul Smith1-31/+1
In various places we were passing flags and characters to compare, then using complex conditionals to see where to stop in string searches. Performance numbers reveal that we were spending as much as 23% of our processing time in these functions, most of it in the comparison lines. Instead create a character map and use a single bitwise comparison to determine if this is any one of the stop characters.
2013-05-17Update source file format: remove TABs, use GNU coding styles.Paul Smith1-83/+83
2013-05-17Update copyright for changes in 2013.Paul Smith1-1/+1
2013-05-13Add new --trace[=MODE] flags, with --trace=dirPaul Smith1-6/+2
This mode replaces the previous heuristic setting enabled with -O, where we would log directory enter/leave for each synchronized output. Now we only do that if --trace=dir is given.
2013-05-05Ensure command lines are written synchronously with -O.Paul Smith1-20/+4
If output-sync is enabled, have make write the command line to the temp file instead of printing it directly to the screen to ensure that the output is ordered properly. Also, remove extraneous enter/leave operations by having them printed directly when dumping temp file output.
2013-05-04Improve sync handling for -Ojob/-Otarget and recursion.Paul Smith1-6/+13
If we are not going to sync a command line then dump any collected output first to preserve ordering. Do some code cleanup: * Move the handle init to a separate function. * Move the temp file truncation to the output function. * Remember whether we sync in a variable for readability. * Handle EINTR and short writes in child_out(). * Always call sync_output() in case output_sync was changed due to error.
2013-04-28Ensure error messages are printed with sync'd output.Paul Smith1-0/+73
Enhance the child_error() function so that it will write error output to the child's sync output buffer, if it exists. If it doesn't the output goes to stdout/stderr.
2013-04-28Remove support for pre-ANSI variadic function calls.Paul Smith1-77/+14
We've required support for ANSI C (ISO C 89) or better for quite a while. Get rid of the old varags.h, doprnt() stuff and simply assume ANSI C variadic function capability and basic C runtime library support (vfprintf, vsprintf, etc.)
2013-04-16Create an open_tmpfd() function to return temp files by FD. Use it.Paul Smith1-0/+79
2013-04-14Rename the "parallel-sync" option to "output-sync".Paul Smith1-6/+6
2013-04-14Initial patch for output synchronization. See Savannah bug #33138.Frank Heckenbach1-3/+21
Based on work by David Boyce <David.S.Boyce@gmail.com>.
2013-01-20Rename struct floc to typedef gmk_floc as an externally scoped symbol.Paul Smith1-4/+4
2013-01-20Rename the make.h file to makeint.h for internal use only.Paul Smith1-1/+1
2012-03-05Simplify copyrights using ranges of years.Paul Smith1-3/+1
The new GNU Maintainer's Manual allows the use of year ranges in certain situations; take advantage of this simplification.
2012-03-04Convert all "`'" quotes to "''" per new GNU Coding Standard guidelines.Paul Smith1-2/+2
Fixes Savannah bug #34530.
2012-03-03Modify backslash/newline handling for POSIX.Paul Smith1-3/+8
We fixed Savannah 16670 but that broke previously-working makefiles that relied on the GNU make behavior. The POSIX behavior doesn't seem to me to be better, and can be obtained using GNU make as well, so put it back as the default behavior and require .POSIX to get the POSIX behavior. Add a new section to the manual discussing backslash/newline handling. Update the test suite.
2012-01-16Update copyright notices.Paul Smith1-3/+3
2011-11-14Changes to resolve warnings.Paul Smith1-1/+1
Fixes Savannah bug #34608.
2010-11-06Improve backslash/newline handling to adhere to POSIX requirements.Paul Smith1-3/+0
2010-07-19- Many fixup patches from Savannah.Paul Smith1-0/+28
- Fix the test suite on Solaris (from Boris) - Update the manual for .ONESHELL
2010-07-16Fix buffer overrun in concat().Boris Kolpackov1-0/+8
2010-07-13Update copyrights for 2010.Paul Smith1-2/+2
2009-10-25Update copyright years.Paul Smith1-2/+2
2009-09-24- Rework secondary expansion so we only defer it if there's a possibilityPaul Smith1-3/+6
it might be needed: for most situations we parse prereqs immediately as we used to. Reduces memory usage. - Fixes Savannah bug #18622.
2009-09-16- Add xcalloc() and call itPaul Smith1-37/+48
- Fix memory errors found by valgrind - Remove multi_glob() and empower parse_file_seq() to do its job: the goal here is to remove the confusing reverse/re-reverse we do on the file lists: needed for future fixes. - Add a prefix arg to parse_file_seq() - Make concat() variadic so it can take arbitrary #'s of strings
2009-06-04- Modify access of config and gnulib Savannah modules to use GITPaul Smith1-2/+4
- Fix Savannah bug #24655. - Fix Savannah bug #24588. - Fix Savannah bug #24277. - Fix Savannah bug #25697. - Fix Savannah bug #25694. - Fix Savannah bug #25460. - Fix Savannah bug #26207. - Fix Savannah bug #25712. - Fix Savannah bug #26593. - Fix various doc issues.
2009-05-24Found this change in an old CVS workspace: rewrite savestring() to thePaul Smith1-6/+14
more standard xstrndup().
2007-07-04* Update to GPLv3Paul Smith1-4/+4
* Update copyright to 2007 * Fix download URL for translation files (thanks to Thiemo Seufer)
2007-05-09Fix Savannah bug #19656: rationalize our use of case-insensitive stringPaul Smith1-0/+27
comparison functions to always use POSIX strcasecmp(). For non-POSIX systems that use other functions (strcmpi or stricmp) use a macro to alias strcasecmp to those. If we can't find any of them (VMS, plus whatever UNIX doesn't have them) then define our own version in misc.c.
2007-03-20This is a major update, which switches virtually every allocated-but-not-freedPaul Smith1-63/+38
string into the strcache. As a side-effect, many more structure members and function arguments can/should be declared const. As mentioned in the changelog, unfortunately measurement shows that this change does not yet reduce memory. The problem is with secondary expansion: because of this we store all the prerequisites in the string cache twice. First we store the prerequisite string after initial expansion but before secondary expansion, then we store each individual file after secondary expansion and expand_deps(). I plan to change expand_deps() to be callable in either context (eval or snap_deps) then have non-second-expansion targets call expand_deps() during eval, so that we only need to store that dependency list once.
2006-04-09Another round of cleanups:Paul Smith1-18/+18
- Add more warnings. - Rename variables that mask out-scope vars with the same name. - Remove all casts of return values from xmalloc, xrealloc, and alloca. - Remove casts of the first argument to xrealloc. - Convert all bcopy/bzero/bcmp invocations to use memcp/memmove/memset/memcmp.
2006-04-01Release GNU make 3.81.Paul Smith1-1/+1
Update NEWS docs. Enhance the manual to use automake version.texi, and use the canonical FSF copyright features and statement. Some $(realpath ...) tests won't work on Windows; leave them out The jobserver filedescriptor test might fail if some FDs are reserved, so for now comment out that check.
2006-03-17Fixed Savannah bug #16053.Boris Kolpackov1-4/+32
2006-02-11Last of the copyright updates.Paul Smith1-1/+2
2006-02-11More copyright/license updates.Paul Smith1-14/+11
2005-10-24Make second expansion optional (partial implementation).Paul Smith1-1/+16
I decided this feature was too impacting to make the permanent default behavior. This set of changes makes the default behavior of make the old behavior (no second expansion). If you want second expansion, you must define the .SECONDEXPANSION: special target before the first target that needs it. This set of changes ONLY fixes explicit and static pattern rules to work like this. Implicit rules still have second expansion enabled all the time: I'll work on that next. Note that there is still a backward-incompatibility: now to get the old SysV behavior using $$@ etc. in the prerequisites list you need to set .SECONDEXPANSION: as well.
2005-06-25Fix Savannah bug #1454: skip over semicolons (and comments) inside variablePaul Smith1-16/+0
references in target definition lines.
2005-06-12Fix Savannah bug # 1328: if stdout is redirected to a full filesystem, wePaul Smith1-0/+47
check for this and exit with an error. The closeout.c version from gnulib pulls in too much other stuff, and gnulib requires an ANSI C 89 compliant compiler, while GNU make (so far) still wants to work on K&R.
2005-02-28* New feature: -L optionPaul Smith1-2/+2
* New function: $(info ...) * Disallow $(eval ...) to create prereq relationships inside command scripts (caused core dumps) * Try to allow more tests to succeed in Windows/DOS by sanitizing CRLF and \ * Various bug fixes and code cleanups (see the ChangeLog entry)
2005-02-27Implementation of the .DEFAULT_TARGET special variable.Boris Kolpackov1-9/+9
2005-02-27Implementation of the second expansion in explicitBoris Kolpackov1-0/+21
rules, static pattern rules and implicit rules.
2004-09-21Remove sindex() and replace with strstr().Paul Smith1-28/+0
Windows: allow users to set SHELL to cmd.exe and have it behave as if no UNIX shell were found.
2004-03-06Don't use __STDC__; some compilers don't set it properly.Paul Smith1-3/+3
Use autoconf's test to set HAVE_ANSI_COMPILER and check that instead.