Skip to content

Remove leading underscores from #defines

Identifiers with leading underscores followed by another underscore or a capital letter are reserved by the C standard and thus should not be used in QEMU. There is especially the bad habit to use these for header guards. Use something like this to find related files:

grep 'define[ \t]*_[A-Z_].*_H[_$]' $(find -name \*.h | egrep -v 'roms|linux-headers|standard-header' )

The current list is:

 include/qemu/plugin-memory.h:#define _PLUGIN_MEMORY_H_
 include/qemu/selfmap.h:#define _SELFMAP_H_
 include/hw/xen/interface/grant_table.h:#define __XEN_PUBLIC_GRANT_TABLE_H__
 include/hw/xen/interface/io/blkif.h:#define __XEN_PUBLIC_IO_BLKIF_H__
 include/hw/xen/interface/io/console.h:#define __XEN_PUBLIC_IO_CONSOLE_H__
 include/hw/xen/interface/io/fbif.h:#define __XEN_PUBLIC_IO_FBIF_H__
 include/hw/xen/interface/io/kbdif.h:#define __XEN_PUBLIC_IO_KBDIF_H__
 include/hw/xen/interface/io/netif.h:#define __XEN_PUBLIC_IO_NETIF_H__
 include/hw/xen/interface/io/protocols.h:#define __XEN_PROTOCOLS_H__
 include/hw/xen/interface/io/usbif.h:#define __XEN_PUBLIC_IO_USBIF_H__
 include/hw/xen/interface/io/ring.h:#define __XEN_PUBLIC_IO_RING_H__
 include/hw/usb/dwc2-regs.h:#define __DWC2_HW_H__
 include/hw/usb/xlnx-usb-subsystem.h:#define _XLNX_VERSAL_USB_SUBSYSTEM_H_
 include/hw/usb/xlnx-versal-usb2-ctrl-regs.h:#define _XLNX_USB2_REGS_H_
 include/fpu/softfloat-helpers.h:#define _SOFTFLOAT_HELPERS_H_
 include/user/syscall-trace.h:#define _SYSCALL_TRACE_H_
 plugins/plugin.h:#define _PLUGIN_INTERNAL_H_
 tests/qtest/fuzz/qos_fuzz.h:#define _QOS_FUZZ_H_
 tests/tcg/minilib/minilib.h:#define _MINILIB_H_

The leading underscores in these #defines should be removed.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information