Skip to content

Commit

Permalink
Issue 38/fix for clang support (#39)
Browse files Browse the repository at this point in the history
* update build configuration

* update makefile for clang

* fix undefined behavior
  • Loading branch information
ggutierrez-sunbright authored Nov 16, 2023
1 parent 6b34dce commit 17962e9
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .github/docker/Dockerfile.ubuntu-22.04-clang
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM ubuntu:22.04 as base

# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends make clang libpopt-dev libpopt0
8 changes: 6 additions & 2 deletions .github/workflows/build_generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
distribution:
required: true
type: string
compiler:
required: false
default: g++
type: string

jobs:
build:
Expand All @@ -24,7 +28,7 @@ jobs:
load: true

- name: Build rDock
run: docker run --rm -v $PWD:/rdock -w /rdock rdock-${{ inputs.distribution }}:base make -j 2
run: docker run --rm -v $PWD:/rdock -w /rdock rdock-${{ inputs.distribution }}:base make CXX=${{ inputs.compiler }} -j 2

- name: Test rDock
run: docker run --rm -v $PWD:/rdock -w /rdock rdock-${{ inputs.distribution }}:base make test
run: docker run --rm -v $PWD:/rdock -w /rdock rdock-${{ inputs.distribution }}:base make CXX=${{ inputs.compiler }} test
9 changes: 8 additions & 1 deletion .github/workflows/build_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ jobs:
- debian-10
- centos-stream8
- centos-centos7
compiler:
- g++
include:
- distribution: ubuntu-22.04-clang
compiler: clang++

uses: ./.github/workflows/build_generic.yml
with:
distribution: ${{ matrix.distribution }}
distribution: ${{ matrix.distribution }}
compiler: ${{ matrix.compiler }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ endif

CXX_FLAGS := $(CXX_BASE_FLAGS) $(CXX_CONFIG_FLAGS) $(CXX_WARNING_FLAGS) $(CXX_EXTRA_FLAGS) $(DEFINES)
LINK_FLAGS := -shared
LIB_DEPENDENCIES := -lpopt -lm
LIB_DEPENDENCIES := -lpopt -lm -lstdc++
LIBS += $(LIB_DEPENDENCIES) -lRbt
INCLUDE := $(addprefix -I./, $(shell find include/ -type d )) $(addprefix -I./, $(shell find import/ -type d ))
LIBRARY := ./lib
Expand Down
4 changes: 2 additions & 2 deletions import/tnt/include/tnt_array1d.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Array1D
Array1D();
explicit Array1D(int n);
Array1D(int n, const T &a);
Array1D(int n, T *a);
Array1D(int n, const T *a);
inline Array1D(const Array1D &A);
inline operator T*();
inline operator const T*();
Expand Down Expand Up @@ -120,7 +120,7 @@ Array1D<T>::Array1D(int n, const T &val) : v_(n), n_(n), data_(v_.begin())
}

template <class T>
Array1D<T>::Array1D(int n, T *a) : v_(a), n_(n) , data_(v_.begin())
Array1D<T>::Array1D(int n, const T *a) : v_(a), n_(n) , data_(v_.begin())
{
#ifdef TNT_DEBUG
std::cout << "Created Array1D(int n, T* a) \n";
Expand Down
8 changes: 7 additions & 1 deletion src/lib/RbtToken.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@
#include "RbtCommands.h"
#include "RbtDebug.h"

namespace RBT {
const RbtVble defaultConstRbtVble;
} // namespace RBT

RbtString RbtToken::_CT("RbtToken");

///////////////////
// Constructors
///////////////////
RbtToken::RbtToken(const RbtVble& v): isvble(true), vble(v), comm(-1) { _RBTOBJECTCOUNTER_CONSTR_(_CT); }

RbtToken::RbtToken(RbtCommands c): isvble(false), comm(c), vble(RbtVble()) { _RBTOBJECTCOUNTER_CONSTR_(_CT); }
RbtToken::RbtToken(RbtCommands c): isvble(false), comm(c), vble(RBT::defaultConstRbtVble) {
_RBTOBJECTCOUNTER_CONSTR_(_CT);
}

RbtToken::RbtToken(const RbtToken& t): isvble(t.isvble), comm(t.comm), vble(t.vble) {
_RBTOBJECTCOUNTER_COPYCONSTR_(_CT);
Expand Down

0 comments on commit 17962e9

Please sign in to comment.