mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
When operator new is used on a class with no constructor it generates an AGGR_INIT_EXPR, not a CALL_EXPR... with testcase. NPODB, static-checking only.
This commit is contained in:
parent
6925784a52
commit
cfb7d3a3c4
@ -167,11 +167,12 @@ function process_cp_pre_genericize(fndecl)
|
||||
break;
|
||||
|
||||
case CALL_EXPR:
|
||||
case AGGR_INIT_EXPR:
|
||||
assign = stack[i + 1];
|
||||
break;
|
||||
|
||||
default:
|
||||
error("Unrecognized assignment from operator new: " + TREE_CODE(assign), getLocation());
|
||||
error("Unrecognized assignment from operator new: %s. Tree code stack: %s".format(TREE_CODE(assign), [TREE_CODE(s) for each (s in stack)].join(",")), getLocation());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,7 @@ STACK_FAILURE_TESTCASES = \
|
||||
StackNoConstructor.cpp \
|
||||
StackVector.cpp \
|
||||
StackConditional.cpp \
|
||||
StackAggrInit.cpp \
|
||||
$(NULL)
|
||||
|
||||
STACK_PASS_TESTCASES = \
|
||||
@ -121,6 +122,8 @@ STATIC_PASS_TESTCASES = \
|
||||
$(FLOW_PASS_TESTCASES) \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = xpcom
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# We want to compile each file and invert the result to ensure that
|
||||
@ -142,13 +145,13 @@ check:: \
|
||||
%.s-warn: %.cpp $(GLOBAL_DEPS) $(DEHYDRA_SCRIPTS)
|
||||
@printf "Compiling $(<F) to check that the static-analysis script is checking properly..."
|
||||
@if $(CCC) -Werror $(OUTOPTION)/dev/null -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) >$(*F).errlog 2>&1; then \
|
||||
printf "fail:\nerror: compilation of $(<F) succeeded with -Werror. It shouldn't have!\n" \
|
||||
printf "fail:\nerror: compilation of $(<F) succeeded with -Werror. It shouldn't have!\n"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@if $(CCC) $(OUTOPTION)/dev/null -S $(COMPILE_CXXFLAGS) $(_VPATH_SRCS) >$(*F).werrlog 2>&1; then \
|
||||
printf "ok.\n"; \
|
||||
else \
|
||||
printf "fail:\nerror: compilation of $(<F) without -Werror failed. A warning should have been issued.\n" \
|
||||
printf "fail:\nerror: compilation of $(<F) without -Werror failed. A warning should have been issued.\n"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
|
12
xpcom/tests/static-checker/StackAggrInit.cpp
Normal file
12
xpcom/tests/static-checker/StackAggrInit.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "nscore.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
class NS_STACK_CLASS A
|
||||
{
|
||||
int i;
|
||||
};
|
||||
|
||||
void Foo()
|
||||
{
|
||||
nsAutoPtr<A> a(new A);
|
||||
}
|
Loading…
Reference in New Issue
Block a user