forked from firemodels/smv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request firemodels#2171 from gforney/master
minor formatting edits to smokeview makefile, add some tests form clang --analyze
- Loading branch information
Showing
5 changed files
with
68 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
@echo off | ||
set file=%1 | ||
set option=%2 | ||
for %%f in (%file%) do ( | ||
set base=%%~nf | ||
) | ||
set OPTS=-D NDEBUG -D WIN32 -D _CONSOLE -D X64 -D GLEW_STATIC -D PTW32_STATIC_LIB | ||
set "CLANGOPTS=--analyze" | ||
if not "x%option%" == "x-t%" goto endif1 | ||
set "CLANGOPTS=--analyze -Xanalyzer -analyzer-checker=core,deadcode -D pp_CLANG_TEST" | ||
:endif1 | ||
set COPTS=-D NDEBUG -D WIN32 -D _CONSOLE -D X64 -D GLEW_STATIC -D PTW32_STATIC_LIB | ||
set INC=-I ../glut_gl -I ../pthreads -I ../smokeview -I ../glui_v2_1_beta -I ../shared -I ../glew -I . -I ../gd-2.0.15 -I ../zlib128 %file% | ||
clang --analyze %INC% %OPTS% %file% 2> %base%.chk | ||
clang %CLANGOPTS% %INC% %COPTS% %file% 2> %base%.chk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "options.h" | ||
#ifdef pp_CLANG_TEST | ||
#include <assert.h> | ||
#include <stdlib.h> | ||
#include <math.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
/* ----------------------- test1 ----------------------------- */ | ||
|
||
void test1(void){ | ||
int a=0, b, c=0, d, e; | ||
int *array=NULL, *barray, carray[3]; | ||
|
||
// divide by zero | ||
b=1/a; | ||
|
||
//use undefined value | ||
c=c+d; | ||
|
||
//access NULL array | ||
c=array[0]; | ||
|
||
//access undefined array | ||
d=barray[0]; | ||
|
||
//access undefined array position | ||
e=carray[0]; | ||
|
||
return; | ||
// dead code | ||
b=1; | ||
c=1; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters