C and C++ Binaries


BADFUNC.FENV_H : Use of <fenv.h> Exception Handling Function

Summary

A use of one of the exception-handling functions defined in <fenv.h>: feclearexcept(), fegetexceptflag(), feraiseexcept(), fesetexceptflag(), fetestexcept(), fegetround(), fesetround(), fegetenv(), feholdexcept(), fesetenv(), feupdateenv(). Using these functions can lead to undefined behavior.

Properties

Class Name Use of <fenv.h> Exception Handling Function
Significance style
Mnemonic BADFUNC.FENV_H
Categories
MisraC2023 MisraC2023:21.12 The standard header file <fenv.h> shall not be used
Misra2012 Misra2012:21.12 The standard header file <fenv.h> shall not be used
AUTOSARC++14 AUTOSARC++14:A1-1-1 All code shall conform to ISO/IEC 14882:2014 - Programming Language C++ and shall not use deprecated features.
MisraC++2023 MisraC++2023:4.1.2 Deprecated features should not be used
CWE CWE:676 Use of Potentially Dangerous Function
CERT-C CERT-C:MSC23-C Beware of vendor-specific library and language differences
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="Use of <fenv.h> Exception Handling Function"

Example

#include <fenv.h>

int do_fp_getenv(fenv_t *fenv)
{
  return fegetenv(fenv); /* 'Use of <fenv.h> Exception Handling Function'
                          * warning issued here */} 
 }

Relevant Configuration File Parameters

This class is implemented using a BAD_FUNCTION_* rule set in the general template configuration file.

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