icg default constructor is deleted (#1109)

* check if default constructor is deleted #1094

* unit test icg deleted default constructor #1094

* Update centos 7 swig version to 3.0 to support deleted function in SIM_deleted_default_constructor test

Co-authored-by: Fennell, Scott P 263712616 <scott.p.fennell@nasa.gov>

closes #1094
This commit is contained in:
Scott Fennell 2021-02-05 19:32:36 -06:00 committed by GitHub
parent e56b32cc2d
commit c0791b46d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 82 additions and 17 deletions

View File

@ -20,7 +20,7 @@ jobs:
run: yum -y groupinstall "Development tools" && yum -y update run: yum -y groupinstall "Development tools" && yum -y update
- name: Install other dependencies - name: Install other dependencies
run: > run: >
yum install -y llvm llvm-devel llvm-static clang clang-devel yum remove -y swig && yum install -y llvm llvm-devel llvm-static clang clang-devel
bison flex gcc gcc-c++ libxml2-devel make cmake wget bison flex gcc gcc-c++ libxml2-devel make cmake wget
ncurses-devel openmotif openmotif-devel python-devel perl ncurses-devel openmotif openmotif-devel python-devel perl
perl-Digest-MD5 swig3 zlib-devel glibc.x86_64 libxml2-devel.i686 perl-Digest-MD5 swig3 zlib-devel glibc.x86_64 libxml2-devel.i686

View File

@ -34,7 +34,6 @@ jobs:
llvm llvm
make make
maven maven
swig
cmake cmake
install_gtest: echo gtest already installed install_gtest: echo gtest already installed
conf_pkg: echo package manager already configured conf_pkg: echo package manager already configured
@ -44,6 +43,7 @@ jobs:
pkg_mgr: apt-get pkg_mgr: apt-get
conf_pkg: apt-get update conf_pkg: apt-get update
arch_deps: >- arch_deps: >-
swig
curl curl
g++ g++
libx11-dev libx11-dev
@ -97,6 +97,7 @@ jobs:
- cfg: { os: fedora } - cfg: { os: fedora }
pkg_mgr: dnf pkg_mgr: dnf
os_deps: >- os_deps: >-
swig
perl-Text-Balanced perl-Text-Balanced
python-devel python-devel
diffutils diffutils
@ -108,6 +109,7 @@ jobs:
python3.8-dev python3.8-dev
- cfg: { os: centos, tag: 7 } - cfg: { os: centos, tag: 7 }
tag_deps: >- tag_deps: >-
swig3
python-devel python-devel
- cfg: { os: centos, tag: latest } - cfg: { os: centos, tag: latest }
pkg_mgr: dnf pkg_mgr: dnf
@ -117,6 +119,7 @@ jobs:
dnf install -y 'dnf-command(config-manager)' && dnf install -y 'dnf-command(config-manager)' &&
dnf config-manager --enable powertools dnf config-manager --enable powertools
tag_deps: >- tag_deps: >-
swig
python3-devel diffutils python3-devel diffutils
#-------- Job definition ---------------- #-------- Job definition ----------------
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04

View File

@ -5,20 +5,20 @@
This document will walk you through the process of installing Trick on your computer. Please read each section carefully. This document will walk you through the process of installing Trick on your computer. Please read each section carefully.
# Package Dependencies # Package Dependencies
Trick requires various free third party utilities in order to function. All the following products are used by Trick and may already be installed as part of your OS distribution. **Install any missing dependencies with your operating system's [package manager](https://en.wikipedia.org/wiki/Package_manager).** For most operating systems, the default version of a dependency will be compatitable with Trick. Please check the specific OS instructions below for your operating system for more details. Trick requires various free third party utilities in order to function. All the following products are used by Trick and may already be installed as part of your OS distribution. **Install any missing dependencies with your operating system's [package manager](https://en.wikipedia.org/wiki/Package_manager).** For most operating systems, the default version of a dependency will be compatitable with Trick. **We strongly recommend that you use your package manager's default versions if they meet Trick's requirements.** Please check the specific OS instructions below for your operating system for more details.
| Utility | Version | Description | Usage | | Utility | Version | Description | Usage | Notes |
|----------------:|:---------:|:-------------------------:|:--------------------------------------------------------------| |---------------:|:-------:|:-----------------------:|:---------------------------------------------------------:|:------------------------------------------------------|
| [gcc] and g++ | 4.8+ | C/C++ Compiler | Compiles Trick and Trick simulations. | | [gcc] and g++ | 4.8+ | C/C++ Compiler | Compiles Trick and Trick simulations. | |
| [clang]/[llvm] | 3.4.2+ | C/C++ Compiler | Utilized by the interface code generator. | | [clang]/[llvm] | 3.4.2+ | C/C++ Compiler | Utilized by the interface code generator. | |
| [python] | 2.7+ | Programming Language | Lets the user interact with a simulation. | | [python] | 2.7+ | Programming Language | Lets the user interact with a simulation. | Trick has been tested up to python 3.9 as of 02/21 |
| [perl] | 5.6+ | Programming Language | Allows executable scripts in the bin directory to run. | | [perl] | 5.6+ | Programming Language | Allows executable scripts in the bin directory to run. | |
| [java] | 11+ | Programming Language | Necessary for Trick GUIs. | | [java] | 11+ | Programming Language | Necessary for Trick GUIs. | |
| [swig] | 2.0+ | Language Interfacing | Connects the python input processor with Trick's C code. | | [swig] | 2.0+ | Language Interfacing | Connects the python input processor with Trick's C code. | 3.0+ required for some unit tests in make test target |
| [make] | 3.78+ | Build Automation | Automates the building and cleaning of Trick. | | [make] | 3.78+ | Build Automation | Automates the building and cleaning of Trick. | |
| [openmotif] | 2.2.0+ | GUI Toolkit | Covers Trick GUIs not made with Java. | | [openmotif] | 2.2.0+ | GUI Toolkit | Covers Trick GUIs not made with Java. | |
| [udunits] | 2.x+ | C Unit Library/Database | Provides support for units of physical quantities. | | [udunits] | 2.x+ | C Unit Library/Database | Provides support for units of physical quantities. | |
| [maven] | x.x | Java package manager | Downloads Java dependencies and builds trick GUIs | | [maven] | x.x | Java package manager | Downloads Java dependencies and builds trick GUIs | |
[gcc]: https://gcc.gnu.org/ [gcc]: https://gcc.gnu.org/
[clang]: https://clang.llvm.org/ [clang]: https://clang.llvm.org/
@ -109,7 +109,7 @@ Run yum -y install epel-release && yum -y update
Trick also requires development packages from the base and epel repositories Trick also requires development packages from the base and epel repositories
```bash ```bash
yum install -y bison clang flex git llvm make maven swig cmake clang-devel \ yum install -y bison clang flex git llvm make maven swig3 cmake clang-devel \
gcc gcc-c++ java-11-openjdk-devel libxml2-devel llvm-devel llvm-static \ gcc gcc-c++ java-11-openjdk-devel libxml2-devel llvm-devel llvm-static \
ncurses-devel openmotif openmotif-devel perl perl-Digest-MD5 udunits2 \ ncurses-devel openmotif openmotif-devel perl perl-Digest-MD5 udunits2 \
udunits2-devel which zlib-devel gtest-devel libX11-devel libXt-devel python-devel udunits2-devel which zlib-devel gtest-devel libX11-devel libXt-devel python-devel

View File

@ -0,0 +1,3 @@
trick.stop(0.5);

View File

@ -0,0 +1,22 @@
/************************TRICK HEADER*************************
PURPOSE:
()
LIBRARY DEPENDENCIES:
*************************************************************/
#include "sim_objects/default_trick_sys.sm"
##include "starter.h"
##include "empty.h"
class StarterSimObject : public Trick::SimObject {
public:
Starter starter;
StarterSimObject() : starter(5){
}
};
StarterSimObject starterSimObject;

View File

@ -0,0 +1,3 @@
TRICK_CFLAGS += -I./models
TRICK_CXXFLAGS += -I./models -std=c++11

View File

@ -0,0 +1 @@
#include "empty.h"

View File

@ -0,0 +1,12 @@
/*************************************************************************
PURPOSE: (Empty class)
LIBRARY DEPENDENCY:
(
(empty.cpp)
)
**************************************************************************/
class Empty {
public:
Empty() = delete;
};

View File

@ -0,0 +1,6 @@
#include "starter.h"
Starter::Starter(int foo) {
}

View File

@ -0,0 +1,14 @@
/*************************************************************************
PURPOSE: (Starter class)
LIBRARY DEPENDENCY:
(
(starter.cpp)
)
**************************************************************************/
class Starter {
public:
Starter() = delete;
Starter(int foo);
};

View File

@ -5,6 +5,7 @@ include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
SIMS_TO_COMPILE_ONLY = \ SIMS_TO_COMPILE_ONLY = \
SIM_alloc_test \ SIM_alloc_test \
SIM_default_member_initializer \ SIM_default_member_initializer \
SIM_delete_default_constructor \
SIM_demo_inputfile \ SIM_demo_inputfile \
SIM_exclusion_mechanisms \ SIM_exclusion_mechanisms \
SIM_isystem \ SIM_isystem \

View File

@ -172,7 +172,7 @@ bool CXXRecordVisitor::VisitCXXRecordDecl( clang::CXXRecordDecl *rec ) {
// Test all constructors to see if any of those are the default and public // Test all constructors to see if any of those are the default and public
clang::CXXRecordDecl::ctor_iterator cit ; clang::CXXRecordDecl::ctor_iterator cit ;
for ( cit = rec->ctor_begin() ; cit != rec->ctor_end() ; cit++ ) { for ( cit = rec->ctor_begin() ; cit != rec->ctor_end() ; cit++ ) {
if ( (*cit)->isDefaultConstructor() and (*cit)->getAccess() == clang::AS_public ) { if ( ( !(*cit)->isDeleted() ) and (*cit)->isDefaultConstructor() and (*cit)->getAccess() == clang::AS_public ) {
cval.setHasDefaultConstructor(true) ; cval.setHasDefaultConstructor(true) ;
} }
} }