summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2020-11-17 03:51:20 +1100
committer Vas Crabb <vas@vastheman.com>2020-11-17 03:51:20 +1100
commit5f750e037664002504b1d665ae398cee79fecda8 (patch)
tree576e7ebe0b5f19b2b61589ff81321c3059798c45
parenta17b844979f3c2768eedc93cf8d3bb867af4db0a (diff)
Fixed clang warning in Lua engine properly, converted a few fallthrough comments to attributes, sorted some warning options alphabetically
-rw-r--r--scripts/genie.lua18
-rw-r--r--src/devices/cpu/m68000/m68kmmu.h5
-rw-r--r--src/frontend/mame/luaengine_mem.cpp37
-rw-r--r--src/mame/drivers/igs011.cpp4
4 files changed, 33 insertions, 31 deletions
diff --git a/scripts/genie.lua b/scripts/genie.lua
index db16f3b56b6..d8e74506ce1 100644
--- a/scripts/genie.lua
+++ b/scripts/genie.lua
@@ -989,11 +989,11 @@ end
buildoptions {
"-Wall",
"-Wcast-align",
- "-Wundef",
"-Wformat-security",
+ "-Wundef",
"-Wwrite-strings",
- "-Wno-sign-compare",
"-Wno-conversion",
+ "-Wno-sign-compare",
"-Wno-error=deprecated-declarations",
}
-- warnings only applicable to C compiles
@@ -1060,20 +1060,20 @@ end
os.exit(-1)
end
buildoptions {
+ "-fdiagnostics-show-note-include-stack",
"-Wno-cast-align",
- "-Wno-tautological-compare",
- "-Wno-unused-value",
"-Wno-constant-logical-operand",
- "-fdiagnostics-show-note-include-stack",
- "-Wno-unknown-warning-option",
"-Wno-extern-c-compat",
- "-Wno-unknown-attributes",
"-Wno-ignored-qualifiers",
- "-Wno-pragma-pack" -- clang 6.0 complains when the packing change lifetime is not contained within a header file.
+ "-Wno-pragma-pack", -- clang 6.0 complains when the packing change lifetime is not contained within a header file.
+ "-Wno-tautological-compare",
+ "-Wno-unknown-attributes",
+ "-Wno-unknown-warning-option",
+ "-Wno-unused-value",
}
if ((version >= 100000) and (_OPTIONS["targetos"] ~= 'macosx')) or (version >= 120000) then
buildoptions {
- "-Wno-xor-used-as-pow " -- clang 10.0 complains that expressions like 10 ^ 7 look like exponention
+ "-Wno-xor-used-as-pow", -- clang 10.0 complains that expressions like 10 ^ 7 look like exponention
}
end
else
diff --git a/src/devices/cpu/m68000/m68kmmu.h b/src/devices/cpu/m68000/m68kmmu.h
index 39f53d6524c..2c23f73a623 100644
--- a/src/devices/cpu/m68000/m68kmmu.h
+++ b/src/devices/cpu/m68000/m68kmmu.h
@@ -373,10 +373,10 @@ void update_sr(const int type, const u32 tbl_entry, const int fc)
{
m_mmu_tmp_sr |= M68K_MMU_SR_MODIFIED;
}
- // fall through
+ [[fallthrough]];
case M68K_MMU_DF_DT_TABLE_4BYTE:
- // fall through
+ [[fallthrough]];
case M68K_MMU_DF_DT_TABLE_8BYTE:
@@ -1045,6 +1045,7 @@ void m68851_pmove_put(u32 ea, u16 modes)
}
break;
+ // FIXME: unreachable
if (!(modes & 0x100))
{
pmmu_atc_flush();
diff --git a/src/frontend/mame/luaengine_mem.cpp b/src/frontend/mame/luaengine_mem.cpp
index 8688b0a9621..6da564c866a 100644
--- a/src/frontend/mame/luaengine_mem.cpp
+++ b/src/frontend/mame/luaengine_mem.cpp
@@ -12,11 +12,6 @@
#include "luaengine.ipp"
-#ifdef __clang__
-#pragma clang diagnostic ignored "-Wshift-count-overflow"
-#endif
-
-
namespace {
//-------------------------------------------------
@@ -28,13 +23,14 @@ template <typename T>
T region_read(memory_region &region, offs_t address)
{
T mem_content = 0;
- offs_t lowmask = region.bytewidth() - 1;
+ const offs_t lowmask = region.bytewidth() - 1;
for (int i = 0; i < sizeof(T); i++)
{
int addr = region.endianness() == ENDIANNESS_LITTLE ? address + sizeof(T) - 1 - i : address + i;
if (addr < region.bytes())
{
- mem_content <<= 8;
+ if constexpr (sizeof(T) > 1)
+ mem_content <<= 8;
if (region.endianness() == ENDIANNESS_BIG)
mem_content |= region.as_u8((BYTE8_XOR_BE(addr) & lowmask) | (addr & ~lowmask));
else
@@ -53,7 +49,7 @@ T region_read(memory_region &region, offs_t address)
template <typename T>
void region_write(memory_region &region, offs_t address, T val)
{
- offs_t lowmask = region.bytewidth() - 1;
+ const offs_t lowmask = region.bytewidth() - 1;
for (int i = 0; i < sizeof(T); i++)
{
int addr = region.endianness() == ENDIANNESS_BIG ? address + sizeof(T) - 1 - i : address + i;
@@ -63,7 +59,8 @@ void region_write(memory_region &region, offs_t address, T val)
region.base()[(BYTE8_XOR_BE(addr) & lowmask) | (addr & ~lowmask)] = val & 0xff;
else
region.base()[(BYTE8_XOR_LE(addr) & lowmask) | (addr & ~lowmask)] = val & 0xff;
- val >>= 8;
+ if constexpr (sizeof(T) > 1)
+ val >>= 8;
}
}
}
@@ -77,14 +74,15 @@ template <typename T>
T share_read(memory_share &share, offs_t address)
{
T mem_content = 0;
- offs_t lowmask = share.bytewidth() - 1;
+ const offs_t lowmask = share.bytewidth() - 1;
uint8_t *ptr = (uint8_t *)share.ptr();
for (int i = 0; i < sizeof(T); i++)
{
int addr = share.endianness() == ENDIANNESS_LITTLE ? address + sizeof(T) - 1 - i : address + i;
if (addr < share.bytes())
{
- mem_content <<= 8;
+ if constexpr (sizeof(T) > 1)
+ mem_content <<= 8;
if (share.endianness() == ENDIANNESS_BIG)
mem_content |= ptr[(BYTE8_XOR_BE(addr) & lowmask) | (addr & ~lowmask)];
else
@@ -103,7 +101,7 @@ T share_read(memory_share &share, offs_t address)
template <typename T>
void share_write(memory_share &share, offs_t address, T val)
{
- offs_t lowmask = share.bytewidth() - 1;
+ const offs_t lowmask = share.bytewidth() - 1;
uint8_t *ptr = (uint8_t *)share.ptr();
for (int i = 0; i < sizeof(T); i++)
{
@@ -114,7 +112,8 @@ void share_write(memory_share &share, offs_t address, T val)
ptr[(BYTE8_XOR_BE(addr) & lowmask) | (addr & ~lowmask)] = val & 0xff;
else
ptr[(BYTE8_XOR_LE(addr) & lowmask) | (addr & ~lowmask)] = val & 0xff;
- val >>= 8;
+ if constexpr (sizeof(T) > 1)
+ val >>= 8;
}
}
}
@@ -288,15 +287,16 @@ template <typename T>
T lua_engine::addr_space::direct_mem_read(offs_t address)
{
T mem_content = 0;
- offs_t lowmask = space.data_width() / 8 - 1;
+ const offs_t lowmask = space.data_width() / 8 - 1;
for (int i = 0; i < sizeof(T); i++)
{
int addr = space.endianness() == ENDIANNESS_LITTLE ? address + sizeof(T) - 1 - i : address + i;
uint8_t *base = (uint8_t *)space.get_read_ptr(addr & ~lowmask);
if (base)
{
- mem_content <<= 8;
- if(space.endianness() == ENDIANNESS_BIG)
+ if constexpr (sizeof(T) > 1)
+ mem_content <<= 8;
+ if (space.endianness() == ENDIANNESS_BIG)
mem_content |= base[BYTE8_XOR_BE(addr) & lowmask];
else
mem_content |= base[BYTE8_XOR_LE(addr) & lowmask];
@@ -314,7 +314,7 @@ T lua_engine::addr_space::direct_mem_read(offs_t address)
template <typename T>
void lua_engine::addr_space::direct_mem_write(offs_t address, T val)
{
- offs_t lowmask = space.data_width() / 8 - 1;
+ const offs_t lowmask = space.data_width() / 8 - 1;
for (int i = 0; i < sizeof(T); i++)
{
int addr = space.endianness() == ENDIANNESS_BIG ? address + sizeof(T) - 1 - i : address + i;
@@ -325,7 +325,8 @@ void lua_engine::addr_space::direct_mem_write(offs_t address, T val)
base[BYTE8_XOR_BE(addr) & lowmask] = val & 0xff;
else
base[BYTE8_XOR_LE(addr) & lowmask] = val & 0xff;
- val >>= 8;
+ if constexpr (sizeof(T) > 1)
+ val >>= 8;
}
}
}
diff --git a/src/mame/drivers/igs011.cpp b/src/mame/drivers/igs011.cpp
index 7e4dddecbef..a7fa32b9b1f 100644
--- a/src/mame/drivers/igs011.cpp
+++ b/src/mame/drivers/igs011.cpp
@@ -1747,7 +1747,7 @@ u16 igs011_state::lhb2_igs003_r()
if (~m_igs_input_sel & 0x04) return m_io_key[2]->read();
if (~m_igs_input_sel & 0x08) return m_io_key[3]->read();
if (~m_igs_input_sel & 0x10) return m_io_key[4]->read();
- /* fall through */
+ [[fallthrough]];
default:
logerror("%06x: warning, reading with igs003_reg = %02x\n", m_maincpu->pc(), m_igs003_reg);
break;
@@ -1882,7 +1882,7 @@ u16 igs011_state::xymg_igs003_r()
if (~m_igs_input_sel & 0x04) return m_io_key[2]->read();
if (~m_igs_input_sel & 0x08) return m_io_key[3]->read();
if (~m_igs_input_sel & 0x10) return m_io_key[4]->read();
- /* fall through */
+ [[fallthrough]];
case 0x20: return 0x49;
case 0x21: return 0x47;