Attention is currently required from: Thomas Heijligen, Anastasia Klimchuk.
Felix Singer has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/68433 )
Change subject: tests: Add prefix to io_mock functions not to clash with macros ......................................................................
Patch Set 5:
(3 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/68433/comment/2d813b15_5fee52ea PS5, Line 10: 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 stays as they are I don't understand this yet. I have some questions:
* Why is it a problem that standard IO functions are macros? * How does the prefix prevent that the flashrom mocks are expanded? I don't understand the relation between that function pointer and the standard I/O functions. * Shouldn't undefining _FORTIFY_SOURCE solve that problem? In my understanding standard I/O functions are not expanded when _FORTIFY_SOURCE is undefined.
https://review.coreboot.org/c/flashrom/+/68433/comment/2731a9ce_9ca9658f PS5, Line 13: stays typo: stay (without s)
File tests/io_mock.h:
https://review.coreboot.org/c/flashrom/+/68433/comment/4584ff5e_6e5b08c6 PS5, Line 73: /* Port I/O */ : void (*outb)(void *state, unsigned char value, unsigned short port); : unsigned char (*inb)(void *state, unsigned short port); : : void (*outw)(void *state, unsigned short value, unsigned short port); : unsigned short (*inw)(void *state, unsigned short port); : : void (*outl)(void *state, unsigned int value, unsigned short port); : unsigned int (*inl)(void *state, unsigned short port); : : /* USB I/O */ : int (*libusb_init)(void *state, libusb_context **ctx); : int (*libusb_control_transfer)(void *state, : libusb_device_handle *devh, : uint8_t bmRequestType, : uint8_t bRequest, : uint16_t wValue, : uint16_t wIndex, : unsigned char *data, : uint16_t wLength, : unsigned int timeout); : ssize_t (*libusb_get_device_list)(void *state, libusb_context *, libusb_device ***list); : void (*libusb_free_device_list)(void *state, libusb_device **list, int unref_devices); : int (*libusb_get_device_descriptor)(void *state, libusb_device *, struct libusb_device_descriptor *); : int (*libusb_get_config_descriptor)(void *state, : libusb_device *, : uint8_t config_index, : struct libusb_config_descriptor **); : void (*libusb_free_config_descriptor)(void *state, struct libusb_config_descriptor *); I am wondering, should these functions be renamed as well?