C and C++


LANG.STRUCT.ELLIPSIS : Ellipsis

Summary

A function definition uses ellipsis notation (...) (that is, the function is defined to be variadic).

Properties

Class Name Ellipsis
Significance style
Mnemonic LANG.STRUCT.ELLIPSIS
Categories
Misra2004 Misra2004:16.1 Functions shall not be defined with variable numbers of arguments
AUTOSARC++14 AUTOSARC++14:A8-4-1 Functions shall not be defined using the ellipsis notation.
MisraC++2008 MisraC++2008:8-4-1 Functions shall not be defined using the ellipsis notation.
MisraC++2023 MisraC++2023:8.2.11 An argument passed via ellipsis shall have an appropriate type
CWE CWE:1056 Invokable Control Element with Variadic Parameters
CERT-C CERT-C:DCL11-C Understand the type issues associated with variadic functions
CERT-CPP CERT-CPP:DCL50-CPP Do not define a C-style variadic function
JSF++ JSF++:108 Functions with variable numbers of arguments shall not be used.
JPL JPL:25 Use short functions with a limited number of parameters.
Availability Available for C and C++.
Enabling Checks for this warning class are disabled by default. To enable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += allow class="Ellipsis"

Example

int lang_struct_ellipsis(int a, int b, ...){  /* 'Ellipsis' warning issued here */
   return  a;                                 /* varargs do not need to be used for warning to be issued. */
}

int fixed_arity(int a, int b){                                    /* ok: no ellipsis */
   return  a;
}

int decl_only(int a, int b, ...);                                 /* ok: not a function definition */

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.