mbox series

[XEN,v2,0/7] fix missing headers and static storage duration

Message ID cover.1691655814.git.nicola.vetrini@bugseng.com (mailing list archive)
Headers show
Series fix missing headers and static storage duration | expand

Message

Nicola Vetrini Aug. 10, 2023, 8:39 a.m. UTC
The files touched by this series contain function or variable definitions with
no prior declaration visible, because it's inside an header that is not included
or it's not present anywhere. This is a risk in itself, but also violates
MISRA C:2012 Rule 8.4, which states the following:
"A compatible declaration shall be visible when an object or function with
external linkage is defined".

The resolution strategies are as follows:

1. make the functions/variables static
2. include the header that contains the compatible declaration, or add one in
   the header if that's not the case.

No functional change.

Additional notes:
- other cases, such as functions/variables used only in asm code will be possibly
  dealt with in future patches.
- functions in 'gcov_base.c' are deviated, since they are called only from code
  generated by gcc in a particular non-release build configuration;
- variables in 'xen/include/acpi/acglobal.h' are deviated temporarily, since
  it's uncertain whether modifying the include pattern to be compliant with the
	rule would introduce subtle bugs.

---
Changes in v2:
- Modified commit messages, with additional "Fixed" tags and mention that these
  are bugfixes
- Split patch 4/8 of the previous version
- Drop patch 7/8 of the previous version, because it's already addressed by this
  patch [1]

[1] https://lists.xen.org/archives/html/xen-devel/2023-05/msg00896.html

Nicola Vetrini (7):
  xen/memory: make 'ioreq_server_max_frames' static
  xen: make 'saved_cmdline' static
  xen/include: make a declaration of 'get_sec' visible where needed
  xen/arm: make declarations visible before function definitions
  x86: make some functions and variables static rather than extern
  xen/arm: mm: add missing extern variable declaration
  x86/nmi: include missing header with declarations for 'watchdog_*'

 xen/arch/arm/include/asm/mm.h     | 3 +++
 xen/arch/arm/setup.c              | 1 +
 xen/arch/arm/time.c               | 1 +
 xen/arch/x86/cpu/mcheck/mce.c     | 2 +-
 xen/arch/x86/cpu/mcheck/mce_amd.c | 2 +-
 xen/arch/x86/cpu/microcode/core.c | 2 +-
 xen/arch/x86/nmi.c                | 3 ++-
 xen/arch/x86/spec_ctrl.c          | 4 ++--
 xen/common/kernel.c               | 2 +-
 xen/common/memory.c               | 2 +-
 xen/include/xen/cper.h            | 3 +--
 xen/include/xen/time.h            | 1 +
 12 files changed, 16 insertions(+), 10 deletions(-)

--
2.34.1