summaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2023-03-18 17:24:45 -0400
committerPaul Smith <psmith@gnu.org>2023-04-02 10:02:18 -0400
commita0d1e76d604df5bd006fd5ed6a69963d3c6b4d7a (patch)
tree02d739d8168207be28535f359b0a6583f231f047 /src/misc.c
parent03ecd94488b85adc38746ec3e7c2a297a522598e (diff)
downloadmake-git-a0d1e76d604df5bd006fd5ed6a69963d3c6b4d7a.tar.gz
Add support for .WARNINGS special variable
Create a new special variable, .WARNINGS, to allow per-makefile control over warnings. The command line settings will override this. Move the handling of warning flags to a new file: src/warning.c. Allow the decode to work with generic strings, and call it from decode_switches(). * Makefile.am: Add new file src/warning.c. * build_w32.bat: Ditto. * builddos.bat: Ditto. * po/POTFILES.in: Ditto. * src/makeint.h: #define for the .WARNINGS variable name. * src/warning.h: Add declarations for methods moved from main.c. Rename the enum warning_state to warning_action. * src/warning.c: New file. Move all warning encode/decode here from main.c. * src/main.c: Move methods into warning.c and call those methods instead. (main): Set .WARNINGS as a special variable. * src/job.c (construct_command_argv): Rename to warning_action. * src/read.c (tilde_expand): Ditto. * src/variable.c (set_special_var): Update warnings when the .WARNINGS special variable is set. * tests/scripts/options/warn: Check invalid warning options. * tests/scripts/variables/WARNINGS: Add tests for the .WARNINGS special variable.
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/misc.c b/src/misc.c
index 80fd63ac..04437c2b 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -437,6 +437,7 @@ find_next_token (const char **ptr, size_t *lengthptr)
return (char *)p;
}
+
/* Write a BUFFER of size LEN to file descriptor FD.
Retry short writes from EINTR. Return LEN, or -1 on error. */
ssize_t
@@ -611,7 +612,7 @@ get_tmpdir ()
unsigned int found = 0;
for (tp = tlist; *tp; ++tp)
- if ((tmpdir = getenv (*tp)) && *tmpdir != '\0')
+ if ((tmpdir = getenv (*tp)) != NULL && *tmpdir != '\0')
{
struct stat st;
int r;