Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cpychecker: cope with gcc.GimpleNop

  • Loading branch information...
commit fc3f5bb9afa64d7d6612520c4d59f56db0334b73 1 parent 1c4f2b8
@davidmalcolm authored
View
6 docs/gimple.rst
@@ -113,6 +113,8 @@ Subclass Meaning
LABEL:
+:py:class:`gcc.GimpleNop` The "do nothing" statement
+
:py:class:`gcc.GimplePhi` Used in the SSA passes::
LHS = PHI <ARG1, ..., ARGN>;
@@ -149,7 +151,6 @@ Subclass Meaning
:py:class:`gcc.GimpleEhMustNotThrow` Used in exception-handling
:py:class:`gcc.GimpleErrorMark` A dummy statement used for handling internal errors
:py:class:`gcc.GimpleGoto` An unconditional jump
-:py:class:`gcc.GimpleNop` The "do nothing" statement
:py:class:`gcc.GimpleOmpAtomicLoad` Used for implementing OpenMP
:py:class:`gcc.GimpleOmpAtomicStore` (ditto)
:py:class:`gcc.GimpleOmpContinue` (ditto)
@@ -371,7 +372,10 @@ Subclass Meaning
The kind of the expression, as an :py:class:`gcc.Tree` subclass (the type
itself, not an instance)
+.. py:class:: gcc.GimpleNop
+ Subclass of :py:class:`gcc.Gimple`, representing a "do-nothing" statement
+ (a.k.a. "no operation").
.. Here's a dump of the class hierarchy, from help(gcc):
.. Gimple
View
2  libcpychecker/absinterp.py
@@ -2088,7 +2088,7 @@ def _get_transitions_for_stmt(self, stmt):
if isinstance(stmt, gcc.GimpleCall):
return self._get_transitions_for_GimpleCall(stmt)
elif isinstance(stmt, (gcc.GimpleDebug, gcc.GimpleLabel,
- gcc.GimplePredict)):
+ gcc.GimplePredict, gcc.GimpleNop)):
return [Transition(self,
self.use_next_loc(),
None)]
View
38 tests/cpychecker/refcounts/cplusplus/empty-function/input.cc
@@ -0,0 +1,38 @@
+/*
+ Copyright 2012 David Malcolm <dmalcolm@redhat.com>
+ Copyright 2012 Red Hat, Inc.
+
+ This is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ Verify that the checker can cope with an empty C++ virtual function
+ (this contains a gcc.GimpleNop, in gcc-4.6 at least)
+ */
+#include <Python.h>
+
+class Test
+{
+public:
+ virtual void foo() {}
+};
+
+/*
+ PEP-7
+Local variables:
+c-basic-offset: 4
+indent-tabs-mode: nil
+End:
+*/
View
22 tests/cpychecker/refcounts/cplusplus/empty-function/script.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Copyright 2011 David Malcolm <dmalcolm@redhat.com>
+# Copyright 2011 Red Hat, Inc.
+#
+# This is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+from libcpychecker import main
+main(verify_refcounting=True,
+ dump_traces=True,
+ show_traces=False)
View
5 tests/cpychecker/refcounts/cplusplus/empty-function/stdout.txt
@@ -0,0 +1,5 @@
+Trace 0:
+ Transitions:
+ 'returning'
+ Exception:
+ (struct PyObject *)0
Please sign in to comment.
Something went wrong with that request. Please try again.