Il 23/08/2012 21:37, rbmj ha scritto: >> In gcc/gcov-io.c, the call to open() only has two arguments. This >> is fine, as long as the system open() is standards compliant. >>>> So you have to add another fixincludes hack, adding a macro indirection >>>> like the one you have for ioctl: >>>> >>>> #define open(a, b, ...) __open(a, b , ##__VA_ARGS__, 0660) >>>> #define __open(a, b, c, ...) (open)(a, b, c) > Also forgot to note: I've seen passing the extra argument > unconditionally (even though it's for a read-only open) other places in > GCC sources, so that seems to be accepted practice.
It doesn't really seem to be the case, they look more like cut-and-paste: With: ./c-family/c-pch.c: fd = open (name, O_RDONLY | O_BINARY, 0666); ./mips-tfile.c: in_fd = open (object_name, O_RDONLY, 0666); ./gcc.c: desc = open (filename, O_RDONLY, 0); Without: ./mips-tdump.c: tfile_fd = open (argv[optind], O_RDONLY); ./ggc-page.c: G.dev_zero_fd = open ("/dev/zero", O_RDONLY); ./lto/lto.c: fd = open (file_data->file_name, O_RDONLY|O_BINARY); ./ggc-zone.c: G.dev_zero_fd = open ("/dev/zero", O_RDONLY); ./gcov-io.c: fd = open (name, O_RDONLY); ./collect2-aix.c: ldfile->fd = open (filename, O_RDONLY); ./java/resource.c: fd = open (filename, O_RDONLY | O_BINARY); ./java/win32-host.c: return open (filename, oflag); ./java/jcf-io.c: fd = open (zipfile, O_RDONLY | O_BINARY); ./java/jcf-io.c: int fd = open (filename, O_RDONLY | O_BINARY); ./gcc.c: int fd = open (cmpfile[i], O_RDONLY); ./config/rs6000/driver-rs6000.c: fd = open ("/proc/self/auxv", O_RDONLY); ./config/rs6000/driver-rs6000.c: fd = open ("/proc/self/auxv", O_RDONLY); ./config/alpha/host-osf.c: procfd = open (pname, O_RDONLY); Paolo