Resolve the static-analysis bustage from bug 498938 by recognizing COND_EXPR.

This commit is contained in:
Benjamin Smedberg 2009-07-27 10:47:22 -04:00
parent 70800cbbcc
commit 6863d9f3f4
5 changed files with 28 additions and 3 deletions

View File

@ -161,6 +161,7 @@ function process_cp_pre_genericize(fndecl)
let assign = stack[i];
switch (TREE_CODE(assign)) {
case VAR_DECL:
case COND_EXPR:
break;
case INIT_EXPR:

View File

@ -58,10 +58,12 @@ STACK_FAILURE_TESTCASES = \
StackVector.cpp \
StackConditional.cpp \
StackAggrInit.cpp \
StackCondBad.cpp \
$(NULL)
STACK_PASS_TESTCASES = \
StackPlacementNewOK.cpp \
StackCond.cpp \
$(NULL)
OUTPARAMS_WARNING_TESTCASES = \

View File

@ -0,0 +1,12 @@
#include "nscore.h"
struct A
{
};
A* tfunc(int len)
{
A arr[5];
A* a = len <= 5 ? arr : new A[len];
return a;
}

View File

@ -0,0 +1,12 @@
#include "nscore.h"
struct NS_STACK_CLASS A
{
};
A* tfunc(int len)
{
A arr[5];
A* a = len <= 5 ? arr : new A[len];
return a;
}

View File

@ -3,9 +3,7 @@ typedef int PRInt32;
typedef PRUint32 nsresult;
nsresult foo(__attribute__((user("outparam"))) int *a) {
int x;
nsresult foo(nsresult x, __attribute__((user("outparam"))) int *a) {
if (x == 0) {
*a = 1;
}