From 84d5316aa71827c79498660092667e306cfc5802 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 24 Jul 2020 16:32:59 -0400 Subject: [PATCH 1/5] Add c++1z as a config option, for older versions of Qt. --- OSBindings/Qt/ClockSignal.pro | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OSBindings/Qt/ClockSignal.pro b/OSBindings/Qt/ClockSignal.pro index aa1b8b624..2a29e5a66 100644 --- a/OSBindings/Qt/ClockSignal.pro +++ b/OSBindings/Qt/ClockSignal.pro @@ -1,6 +1,9 @@ QT += core gui multimedia widgets +# Be specific about C++17 but also try the vaguer C++1z for older +# versions of Qt. CONFIG += c++17 +CONFIG += c++1z # Permit multiple source files in different directories to have the same file name. CONFIG += object_parallel_to_source From 8af35bc6bbb57b4fb74e8104e6b0933e77fdb85a Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 24 Jul 2020 21:55:33 -0400 Subject: [PATCH 2/5] Resolves signed comparison mismatches. --- Storage/Tape/Formats/TZX.cpp | 4 ++-- Storage/Tape/Formats/TZX.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Storage/Tape/Formats/TZX.cpp b/Storage/Tape/Formats/TZX.cpp index 1e0b6ceda..8d45f6a8a 100644 --- a/Storage/Tape/Formats/TZX.cpp +++ b/Storage/Tape/Formats/TZX.cpp @@ -247,10 +247,10 @@ void TZX::get_data_block(const DataBlock &data_block) { void TZX::get_data(const Data &data) { // Output data. - for(unsigned int c = 0; c < data.data_length; c++) { + for(decltype(data.data_length) c = 0; c < data.data_length; c++) { uint8_t next_byte = file_.get8(); - unsigned int bits = (c != data.data_length-1) ? 8 : data.number_of_bits_in_final_byte; + auto bits = (c != data.data_length-1) ? 8 : data.number_of_bits_in_final_byte; while(bits--) { unsigned int pulse_length = (next_byte & 0x80) ? data.length_of_one_bit_pulse : data.length_of_zero_bit_pulse; next_byte <<= 1; diff --git a/Storage/Tape/Formats/TZX.hpp b/Storage/Tape/Formats/TZX.hpp index e38ad66ec..277cd2464 100644 --- a/Storage/Tape/Formats/TZX.hpp +++ b/Storage/Tape/Formats/TZX.hpp @@ -77,7 +77,7 @@ class TZX: public PulseQueuedTape { unsigned int length_of_one_bit_pulse; unsigned int number_of_bits_in_final_byte; unsigned int pause_after_block; - long data_length; + uint32_t data_length; }; struct DataBlock { From b9616659850819a2de9c2d89de5002fd3db36f06 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 24 Jul 2020 21:56:20 -0400 Subject: [PATCH 3/5] Ensures WOZ2 behaviour even if `type_` has an invalid value. This pleases GCC 7. --- Storage/Disk/DiskImage/Formats/WOZ.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Storage/Disk/DiskImage/Formats/WOZ.cpp b/Storage/Disk/DiskImage/Formats/WOZ.cpp index c11292078..98c9151d4 100644 --- a/Storage/Disk/DiskImage/Formats/WOZ.cpp +++ b/Storage/Disk/DiskImage/Formats/WOZ.cpp @@ -166,6 +166,7 @@ std::shared_ptr WOZ::get_track_at_position(Track::Address address) { number_of_bits = std::min(file_.get16le(), uint16_t(6646*8)); break; + default: case Type::WOZ2: { // In WOZ 2 an extra level of indirection allows for variable track sizes. const uint16_t starting_block = file_.get16le(); From fa95a17af5aa1a465ab07b6248043bd9a989f09f Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 24 Jul 2020 21:59:27 -0400 Subject: [PATCH 4/5] Resolves receive_bit_count-unused warnings. --- Components/8530/z8530.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Components/8530/z8530.cpp b/Components/8530/z8530.cpp index e4afa96e5..f65c2dbc6 100644 --- a/Components/8530/z8530.cpp +++ b/Components/8530/z8530.cpp @@ -316,6 +316,8 @@ void z8530::Channel::write(bool data, uint8_t pointer, uint8_t value) { } LOG("Receive bit count: " << receive_bit_count); + (void)receive_bit_count; + /* b7,b6: 00 = 5 receive bits per character From e097a841d2077f871112f41daeaa0d979977101b Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 24 Jul 2020 22:01:22 -0400 Subject: [PATCH 5/5] Adds a c++1z fallback for SDL builds, too. --- OSBindings/SDL/SConstruct | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/OSBindings/SDL/SConstruct b/OSBindings/SDL/SConstruct index e1a746ac8..f55a0e22b 100644 --- a/OSBindings/SDL/SConstruct +++ b/OSBindings/SDL/SConstruct @@ -1,19 +1,19 @@ import glob import sys -# establish UTF-8 encoding for Python 2 +# Establish UTF-8 encoding for Python 2. if sys.version_info < (3, 0): reload(sys) sys.setdefaultencoding('utf-8') -# create build environment +# Create build environment. env = Environment() -# determine compiler and linker flags for SDL +# Determine compiler and linker flags for SDL. env.ParseConfig('sdl2-config --cflags') env.ParseConfig('sdl2-config --libs') -# gather a list of source files +# Gather a list of source files. SOURCES = glob.glob('*.cpp') SOURCES += glob.glob('../../Analyser/Dynamic/*.cpp') @@ -117,11 +117,11 @@ SOURCES += glob.glob('../../Storage/Tape/*.cpp') SOURCES += glob.glob('../../Storage/Tape/Formats/*.cpp') SOURCES += glob.glob('../../Storage/Tape/Parsers/*.cpp') -# add additional compiler flags -env.Append(CCFLAGS = ['--std=c++17', '-Wall', '-O2', '-DNDEBUG']) +# Add additional compiler flags; c++1z is insurance in case c++17 isn't fully implemented. +env.Append(CCFLAGS = ['--std=c++17', '--std=c++1z', '-Wall', '-O2', '-DNDEBUG']) -# add additional libraries to link against +# Add additional libraries to link against. env.Append(LIBS = ['libz', 'pthread', 'GL']) -# build target +# Build target. env.Program(target = 'clksignal', source = SOURCES)