mirror of
https://review.coreboot.org/flashrom.git
synced 2025-08-17 12:20:15 +02:00
tests: Add prefix to io_mock functions not to clash with macros
Flashrom I/O mock functions need to be renamed so that they do not have name clash with standard I/O, because the latter are allowed to be macros. Adding a prefix to flashrom mock functions avoids them being accidentally expanded. Standard I/O functions are expanded and flashrom mocks stay as they are. BUG=b:237606255 TEST=ninja test 1) gcc 12.2.0 on Debian 2) clang 15.0 on Chromium OS Ticket: https://ticket.coreboot.org/issues/411 Change-Id: I7998a8fb1b9e65621e12adbfab5460a245d5606b Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/68433 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
This commit is contained in:
@@ -101,17 +101,17 @@ struct io_mock {
|
||||
void (*libusb_free_config_descriptor)(void *state, struct libusb_config_descriptor *);
|
||||
|
||||
/* POSIX File I/O */
|
||||
int (*open)(void *state, const char *pathname, int flags);
|
||||
int (*ioctl)(void *state, int fd, unsigned long request, va_list args);
|
||||
int (*read)(void *state, int fd, void *buf, size_t sz);
|
||||
int (*write)(void *state, int fd, const void *buf, size_t sz);
|
||||
int (*iom_open)(void *state, const char *pathname, int flags);
|
||||
int (*iom_ioctl)(void *state, int fd, unsigned long request, va_list args);
|
||||
int (*iom_read)(void *state, int fd, void *buf, size_t sz);
|
||||
int (*iom_write)(void *state, int fd, const void *buf, size_t sz);
|
||||
|
||||
/* Standard I/O */
|
||||
FILE* (*fopen)(void *state, const char *pathname, const char *mode);
|
||||
char* (*fgets)(void *state, char *buf, int len, FILE *fp);
|
||||
size_t (*fread)(void *state, void *buf, size_t size, size_t len, FILE *fp);
|
||||
int (*fprintf)(void *state, FILE *fp, const char *fmt, va_list args);
|
||||
int (*fclose)(void *state, FILE *fp);
|
||||
FILE* (*iom_fopen)(void *state, const char *pathname, const char *mode);
|
||||
char* (*iom_fgets)(void *state, char *buf, int len, FILE *fp);
|
||||
size_t (*iom_fread)(void *state, void *buf, size_t size, size_t len, FILE *fp);
|
||||
int (*iom_fprintf)(void *state, FILE *fp, const char *fmt, va_list args);
|
||||
int (*iom_fclose)(void *state, FILE *fp);
|
||||
|
||||
/*
|
||||
* An alternative to custom open mock. A test can either register its
|
||||
|
Reference in New Issue
Block a user