Skip to content

Commit 268d1f4

Browse files
committed
RULE-21-12: Simplify alert message, remove fenv.h
1 parent 643aa35 commit 268d1f4

File tree

4 files changed

+15
-77
lines changed

4 files changed

+15
-77
lines changed

c/misra/src/rules/RULE-21-12/ExceptionHandlingFeaturesOfFenvhUsed.ql

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,20 @@ class FPExceptionHandlingMacro extends Macro {
3232
}
3333
}
3434

35-
from Locatable call, Locatable def, string name, string kind
35+
from Locatable call, string name, string kind
3636
where
3737
not isExcluded(call, BannedPackage::exceptionHandlingFeaturesOfFenvhUsedQuery()) and
3838
(
3939
exists(FPExceptionHandlingFunction f |
40-
def = f and
4140
call = f.getACallToThisFunction() and
4241
name = f.getName() and
4342
kind = "function"
4443
)
4544
or
4645
exists(FPExceptionHandlingMacro m |
47-
def = m and
4846
call = m.getAnInvocation() and
4947
name = m.getName() and
5048
kind = "macro"
5149
)
5250
)
53-
select call, "Call to banned " + kind + " $@.", def, name
51+
select call, "Call to banned " + kind + " " + name + "."
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
| test.c:4:11:4:23 | call to feclearexcept | Call to banned function $@. | fenv.h:43:5:43:17 | feclearexcept | feclearexcept |
2-
| test.c:4:25:4:34 | FE_INVALID | Call to banned macro $@. | fenv.h:8:1:8:20 | #define FE_INVALID 1 | FE_INVALID |
3-
| test.c:6:3:6:17 | call to fegetexceptflag | Call to banned function $@. | fenv.h:44:5:44:19 | fegetexceptflag | fegetexceptflag |
4-
| test.c:6:24:6:36 | FE_ALL_EXCEPT | Call to banned macro $@. | fenv.h:15:1:15:24 | #define FE_ALL_EXCEPT 63 | FE_ALL_EXCEPT |
5-
| test.c:7:3:7:15 | call to feraiseexcept | Call to banned function $@. | fenv.h:45:5:45:17 | feraiseexcept | feraiseexcept |
6-
| test.c:7:17:7:28 | FE_DIVBYZERO | Call to banned macro $@. | fenv.h:10:1:10:22 | #define FE_DIVBYZERO 4 | FE_DIVBYZERO |
7-
| test.c:8:3:8:15 | call to feraiseexcept | Call to banned function $@. | fenv.h:45:5:45:17 | feraiseexcept | feraiseexcept |
8-
| test.c:8:17:8:27 | FE_OVERFLOW | Call to banned macro $@. | fenv.h:11:1:11:21 | #define FE_OVERFLOW 8 | FE_OVERFLOW |
9-
| test.c:9:3:9:17 | call to fesetexceptflag | Call to banned function $@. | fenv.h:46:5:46:19 | fesetexceptflag | fesetexceptflag |
10-
| test.c:9:24:9:36 | FE_ALL_EXCEPT | Call to banned macro $@. | fenv.h:15:1:15:24 | #define FE_ALL_EXCEPT 63 | FE_ALL_EXCEPT |
11-
| test.c:10:3:10:14 | call to fetestexcept | Call to banned function $@. | fenv.h:47:5:47:16 | fetestexcept | fetestexcept |
12-
| test.c:10:16:10:27 | FE_UNDERFLOW | Call to banned macro $@. | fenv.h:12:1:12:23 | #define FE_UNDERFLOW 16 | FE_UNDERFLOW |
1+
| test.c:4:11:4:23 | call to feclearexcept | Call to banned function feclearexcept. |
2+
| test.c:4:25:4:34 | FE_INVALID | Call to banned macro FE_INVALID. |
3+
| test.c:6:3:6:17 | call to fegetexceptflag | Call to banned function fegetexceptflag. |
4+
| test.c:6:24:6:36 | FE_ALL_EXCEPT | Call to banned macro FE_ALL_EXCEPT. |
5+
| test.c:7:3:7:15 | call to feraiseexcept | Call to banned function feraiseexcept. |
6+
| test.c:7:17:7:28 | FE_DIVBYZERO | Call to banned macro FE_DIVBYZERO. |
7+
| test.c:8:3:8:15 | call to feraiseexcept | Call to banned function feraiseexcept. |
8+
| test.c:8:17:8:27 | FE_OVERFLOW | Call to banned macro FE_OVERFLOW. |
9+
| test.c:9:3:9:17 | call to fesetexceptflag | Call to banned function fesetexceptflag. |
10+
| test.c:9:24:9:36 | FE_ALL_EXCEPT | Call to banned macro FE_ALL_EXCEPT. |
11+
| test.c:10:3:10:14 | call to fetestexcept | Call to banned function fetestexcept. |
12+
| test.c:10:16:10:27 | FE_UNDERFLOW | Call to banned macro FE_UNDERFLOW. |

c/misra/test/rules/RULE-21-12/fenv.h

Lines changed: 0 additions & 60 deletions
This file was deleted.

c/misra/test/rules/RULE-21-12/test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "fenv.h"
1+
#include <fenv.h>
22
void f2();
33
void f1() {
44
int i = feclearexcept(FE_INVALID); // NON_COMPLIANT

0 commit comments

Comments
 (0)