Skip to content

Commit 38eec3f

Browse files
authored
Merge pull request #2097 from riscv-software-src/fix-werror
Actually use -Werror in CI again
2 parents 9145cdc + ffcc3e6 commit 38eec3f

File tree

4 files changed

+27
-16
lines changed

4 files changed

+27
-16
lines changed

ci-tests/build-spike

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ rm -rf build
88
mkdir build
99
cd build
1010
mkdir install
11-
CXXFLAGS="-Wnon-virtual-dtor" CFLAGS="-Werror -Wall -Wextra -Wvla" $DIR/../configure --prefix=`pwd`/install
11+
CFLAGS="-Werror -Wall -Wextra -Wvla"
12+
CXXFLAGS="-Wnon-virtual-dtor $CFLAGS"
13+
CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" $DIR/../configure --prefix=`pwd`/install
1214
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
1315
make check
1416
make install install-hdrs-list.h

riscv/bulknormdot.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define _RISCV_BULKNORMDOT_H
33

44
#include <cstdint>
5-
#include <iostream>
5+
#include <vector>
66
#include "softfloat.h"
77

88
struct bulk_norm_out_t {
@@ -56,6 +56,9 @@ template <typename U, typename M, typename E> class FloatFormat {
5656
virtual bool nan() const = 0;
5757
virtual bool sigNan() const = 0;
5858
virtual bool special() const = 0;
59+
60+
public:
61+
virtual ~FloatFormat() = default;
5962
};
6063

6164
/** Template for an IEEE-754 floating-point format class */
@@ -178,8 +181,8 @@ class ofp8_e4m3 final : public IEEEFloatFormat<uint8_t, uint8_t, uint8_t, 4, 3>
178181
*/
179182
template<typename ValueTypeLHS, typename ValueTypeRHS, typename SigProdType> bulk_norm_out_t bulk_norm_dot_no_mult(const DotConfig cfg, const ValueTypeLHS* a, const ValueTypeRHS* b, const SigProdType* prod_sigs)
180183
{
181-
int approx_prod_exp[cfg.n];
182-
int flushed_prods[cfg.n];
184+
std::vector<int> approx_prod_exp(cfg.n);
185+
std::vector<int> flushed_prods(cfg.n);
183186

184187
bool any_pos_inf = false;
185188
bool any_neg_inf = false;
@@ -299,27 +302,27 @@ template<typename ValueTypeLHS, typename ValueTypeRHS, typename SigProdType> bul
299302
static inline bulk_norm_out_t bulk_norm_dot_bf16(const DotConfig cfg, const bf16_t* a, const bf16_t* b)
300303
{
301304
// product are extracted so that the no-mult version can be more easily matched against the RTL implementation
302-
uint16_t prod_sigs[cfg.n];
305+
std::vector<uint16_t> prod_sigs(cfg.n);
303306

304307
// compute products, normalize to largest exponent, accumulate
305308
for (int i = 0; i < cfg.n; i++) {
306309
prod_sigs[i] = a[i].sig() * (uint16_t) b[i].sig();
307310
}
308311

309-
return bulk_norm_dot_no_mult<bf16_t, bf16_t, uint16_t>(cfg, a, b, prod_sigs);
312+
return bulk_norm_dot_no_mult<bf16_t, bf16_t, uint16_t>(cfg, a, b, &prod_sigs[0]);
310313
}
311314

312315
template <typename L, typename R>
313316
bulk_norm_out_t bulk_norm_dot_ofp8(const DotConfig cfg, const L* a, const R* b)
314317
{
315318
// products are extracted so that the no-mult version can be more easily matched against the RTL implementation
316-
uint16_t prod_sigs[cfg.n];
319+
std::vector<uint16_t> prod_sigs(cfg.n);
317320

318321
// compute products, normalize to largest exponent, accumulate
319322
for (int i = 0; i < cfg.n; i++) {
320323
prod_sigs[i] = a[i].sig() * (uint16_t) b[i].sig();
321324
}
322-
return bulk_norm_dot_no_mult<L, R, uint16_t>(cfg, a, b, prod_sigs);
325+
return bulk_norm_dot_no_mult<L, R, uint16_t>(cfg, a, b, &prod_sigs[0]);
323326
}
324327

325328
#endif

riscv/csrs.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2141,7 +2141,7 @@ inaccessible_csr_t::inaccessible_csr_t(processor_t* const proc, const reg_t addr
21412141
csr_t(proc, addr) {
21422142
}
21432143

2144-
void inaccessible_csr_t::verify_permissions(insn_t insn, bool write) const {
2144+
void inaccessible_csr_t::verify_permissions(insn_t insn, bool UNUSED write) const {
21452145
if (state->v)
21462146
throw trap_virtual_instruction(insn.bits());
21472147
else

riscv/interactive.cc

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ processor_t *sim_t::get_core(const std::string& i)
7272
return get_core(p);
7373
}
7474

75+
static void do_write(int fd, const void* buf, size_t n)
76+
{
77+
auto res = write(fd, buf, n);
78+
(void) res;
79+
}
80+
7581
static void clear_str(bool noncanonical, int fd, std::string target_str)
7682
{
7783
if (noncanonical)
@@ -83,7 +89,7 @@ static void clear_str(bool noncanonical, int fd, std::string target_str)
8389
clear_motion += ' ';
8490
}
8591
clear_motion += '\r';
86-
(void) write(fd, clear_motion.c_str(), clear_motion.size() + 1);
92+
do_write(fd, clear_motion.c_str(), clear_motion.size() + 1);
8793
}
8894
}
8995

@@ -96,7 +102,7 @@ static void send_key(bool noncanonical, int fd, keybuffer_t key_code, const int
96102
{
97103
key_motion += (char) ((key_code >> (i * BITS_PER_CHAR)) & 0xff);
98104
}
99-
(void) write(fd, key_motion.c_str(), len);
105+
do_write(fd, key_motion.c_str(), len);
100106
}
101107
}
102108

@@ -144,7 +150,7 @@ static std::string readline(int fd)
144150
cursor_pos--;
145151
s.erase(cursor_pos, 1);
146152
if (noncanonical)
147-
(void) write(fd, s.c_str(), s.size() + 1);
153+
do_write(fd, s.c_str(), s.size() + 1);
148154
// move cursor by left arrow key
149155
for (unsigned i = 0; i < s.size() - cursor_pos; i++) {
150156
send_key(noncanonical, fd, KEYCODE_LEFT, 3);
@@ -176,7 +182,7 @@ static std::string readline(int fd)
176182
history_index = std::min(history_commands.size(), history_index + 1);
177183
s = history_commands[history_commands.size() - history_index];
178184
if (noncanonical)
179-
(void) write(fd, s.c_str(), s.size() + 1);
185+
do_write(fd, s.c_str(), s.size() + 1);
180186
cursor_pos = s.size();
181187
}
182188
key_buffer = 0;
@@ -192,7 +198,7 @@ static std::string readline(int fd)
192198
s = history_commands[history_commands.size() - history_index];
193199
}
194200
if (noncanonical)
195-
(void) write(fd, s.c_str(), s.size() + 1);
201+
do_write(fd, s.c_str(), s.size() + 1);
196202
cursor_pos = s.size();
197203
}
198204
key_buffer = 0;
@@ -221,7 +227,7 @@ static std::string readline(int fd)
221227
break;
222228
case KEYCODE_ENTER:
223229
if (noncanonical)
224-
(void) write(fd, &ch, 1);
230+
do_write(fd, &ch, 1);
225231
if (s.size() > initial_s_len && (history_commands.size() == 0 || s != history_commands[history_commands.size() - 1])) {
226232
history_commands.push_back(s);
227233
}
@@ -236,7 +242,7 @@ static std::string readline(int fd)
236242
s.insert(cursor_pos, 1, ch);
237243
cursor_pos++;
238244
if (noncanonical)
239-
(void) write(fd, s.c_str(), s.size() + 1);
245+
do_write(fd, s.c_str(), s.size() + 1);
240246
// send left arrow key to move cursor
241247
for (unsigned i = 0; i < s.size() - cursor_pos; i++) {
242248
send_key(noncanonical, fd, KEYCODE_LEFT, 3);

0 commit comments

Comments
 (0)