Skip to content

Commit

Permalink
Fix gcc-12 compilation error (#312)
Browse files Browse the repository at this point in the history
* Fix gcc 12 compiling error

* add test for gcc-12

* replace array with vector

this is to avoid breaking the API down the line

* pin down ubuntu base images 

these do get updated with with under active development and there are changes which could affect us

* skip gtest + set cxx_std to 20

---------

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
  • Loading branch information
sjanel and prince-chrismc authored Nov 26, 2023
1 parent ce1f9df commit 0e3d6a1
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
32 changes: 31 additions & 1 deletion .github/workflows/targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: GCC 4.8
runs-on: ubuntu-latest
container:
image: ubuntu:18.04
image: ubuntu:bionic-20230530 # 18.04
env:
CC: /usr/bin/gcc-4.8
CXX: /usr/bin/g++-4.8
Expand All @@ -43,3 +43,33 @@ jobs:
run: |
CC=gcc-4.8 CXX=g++-4.8 cmake . -DTEST:STRING="defaults-enabled"
cmake --build .
gcc-12:
runs-on: ubuntu-latest
container:
image: ubuntu:jammy-20231004 # 22.04
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
steps:
- run: |
apt-get update
apt-get install -y g++-12 wget make libssl-dev
- uses: actions/checkout@v3
- uses: ./.github/actions/install/cmake
with:
version: "3.26.3"
url: "https://cmake.org/files/v3.26/cmake-3.26.3.tar.gz"

- name: setup
run: |
mkdir build
cd build
cmake ..
cmake --install .
- name: test
working-directory: tests/cmake
run: |
CC=gcc-12 CXX=g++-12 cmake . -DCMAKE_CXX_STANDARD=20 -DTEST:STRING="defaults-enabled"
cmake --build .
8 changes: 4 additions & 4 deletions include/jwt-cpp/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace jwt {
return data;
}
static const std::string& fill() {
static std::string fill{"="};
static const std::string fill{"="};
return fill;
}
};
Expand All @@ -62,7 +62,7 @@ namespace jwt {
return data;
}
static const std::string& fill() {
static std::string fill{"%3d"};
static const std::string fill{"%3d"};
return fill;
}
};
Expand All @@ -82,8 +82,8 @@ namespace jwt {
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_'}};
return data;
}
static const std::initializer_list<std::string>& fill() {
static std::initializer_list<std::string> fill{"%3D", "%3d"};
static const std::vector<std::string>& fill() {
static const std::vector<std::string> fill{"%3D", "%3d"};
return fill;
}
};
Expand Down

0 comments on commit 0e3d6a1

Please sign in to comment.