Edit C code to reduce warnings from clang. Most warnings are for
implicit declarations of functions, but some warnings want me to add
parentheses or curly braces, or to cast arguments for printf().
Make a few other changes, like declaring float_cst() in h/con_float to
be static, and using C99 bool in ego/ra/makeitems.c and
ego/share/makecldef.c. Such changes don't silence warnings; I make
such changes while I silence warnings in the same file. In
float_cst(), rename parameter `str` to `float_str`, so it doesn't
share a name with the global variable `str`.
Remove `const` from `newmodule(const char *)` in mach/proto/as to
silence a warning. I wrongly added the `const` in d347207.
For warnings about implicit declarations of functions, the fix is to
declare the function before calling it. For example, my OpenBSD
system needs <sys/wait.h> to declare wait().
In util/int, add "whatever.h" to declare more functions. Remove old
declarations from "mem.h", to prefer the newer declarations of the
same functions in "data.h" and "stack.h".
This causes clang to give fewer warnings of implicit declarations of
functions.
In mach/pdp/cv/cv.c, rename wr_int2() to cv_int2() because it
conflicts with wr_int2() in <object.h>.
In util/ack, rename F_OK to F_TRANSFORM because it conflicts with F_OK
for access() in <unistd.h>.
This unbreaks my build in OpenBSD. The old `long lseek()` conflicts
with `off_t lseek()` in OpenBSD headers, because long and off_t are
different types. Commit b4df26e caused "system.h" to include some
headers where OpenBSD declares lseek().
Manuals for lseek() say to #include <unistd.h>. Do so to be portable
to systems where other headers don't declare lseek().
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
+ Added support for sys_tmpdir for better portability.
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h (TMPDIR is no longer hard coded)
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h
This got caught by MALLOC_OPTIONS=S in OpenBSD. The B compiler filled
the buffer while compiling hilo.b. Then realloc moved the buffer and
unmapped the old buffer. The compiler tried to read the old buffer
and segfaulted.
With this change, I built and ran ack on a big-endian PowerPC Linux
machine. I used gcc 4.9.4 to build ack, and I only built the linuxppc
back end.
Before this change, wr_ranlib() corrupted a value by changing it from
0x66 to 0x66000066. This value was too big, so led made a fatal
error, "bad ranlib string offset".
I made a syntax error in some .e file, and em_encode dumped core
because a 64-bit pointer didn't fit in a 32-bit int. Now use stdarg
to pass pointers to error() and fatal().
Stop using the number of errors as the exit status. Many systems use
only the low 8 bits of the exit status, so 256 errors would become 0.
Also change modules/src/print to accept const char *buf
Drop dependency on <ansi.h> in modules+headers; assume that compiler
knows ANSI C89.
Add missing dependency from print to string; #include <ack_string.h>.
Because <print.h> had commented out the declarations of sys_lock() and
sys_unlock(), I now stop building lock.c and unlock.c.
Some of these functions were slightly different from libc:
- This strncpy() didn't pad the buffer with '\0' bytes beyond the end
of the string; libc does the padding. This string.3 manual said
that this strncpy() does "null-padding", but it didn't.
- This strcmp() and strncmp() compared using char (which might be
signed); libc compares using unsigned char.