Skip to content

Commit

Permalink
GCC 13 and Werror cleanups
Browse files Browse the repository at this point in the history
Removes some unused code, and ensures most code compiles with gcc 13.
  • Loading branch information
timower committed Aug 1, 2023
1 parent 23bd0bf commit 97a35cb
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 48 deletions.
2 changes: 0 additions & 2 deletions apps/rocket/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ namespace {
#define KEY_POWER 116
#endif

constexpr auto config_path_suffix = ".config/rocket/config";

std::vector<pid_t> stoppedChildren;
std::function<void()> stopCallback;

Expand Down
21 changes: 0 additions & 21 deletions apps/yaft/fb/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,6 @@
#include <iostream>

namespace {
inline uint16_t
color2pixel(uint32_t color) {
uint32_t r, g, b;

r = 0xFF & (color >> (BITS_PER_RGB * 2));
g = 0xFF & (color >> BITS_PER_RGB);
b = 0xFF & (color >> 0);

// RGB 565
r = r >> (BITS_PER_RGB - 5);
g = g >> (BITS_PER_RGB - 6);
b = b >> (BITS_PER_RGB - 5);

return (r << 11) | (g << 5) | (b << 0);
}

inline uint16_t
color2brightness(uint32_t color) {
Expand Down Expand Up @@ -211,12 +196,6 @@ draw_line(rmlib::fb::FrameBuffer& fb, struct terminal_t* term, int line) {

void
refresh(rmlib::fb::FrameBuffer& fb, struct terminal_t* term) {
// if (term->palette_modified) {
// term->palette_modified = false;
// for (int i = 0; i < COLORS; i++)
// fb.real_palette[i] = color2pixel(&fb.info, term->virtual_palette[i]);
// }

if (term->mode & MODE_CURSOR)
term->line_dirty[term->cursor.y] = true;

Expand Down
2 changes: 0 additions & 2 deletions apps/yaft/keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ Keyboard::initKeyMap() {
ctrlKey = -1;

int y = startHeight;
int rowNum = 0;

const auto& currentLayout = hidden ? hidden_layout : layout;

Expand All @@ -437,7 +436,6 @@ Keyboard::initKeyMap() {
}

y += key_height;
rowNum++;
}

int marginLeft = term->width - term->cols * CELL_WIDTH;
Expand Down
24 changes: 17 additions & 7 deletions apps/yaft/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,31 @@ enum loglevel_t {
FATAL,
};

static inline const char*
loglevel2str(enum loglevel_t loglevel) {
switch (loglevel) {
case DEBUG:
return "DEBUG";
case WARN:
return "WARN";
case ERROR:
return "ERROR";
case FATAL:
return "FATAL";
default:
return "UNK";
}
}

static inline void
logging(enum loglevel_t loglevel, const char* format, ...) {
va_list arg;
static const char* loglevel2str[] = {
[DEBUG] = "DEBUG",
[WARN] = "WARN",
[ERROR] = "ERROR",
[FATAL] = "FATAL",
};

/* debug message is available on verbose mode */
if ((loglevel == DEBUG) && (VERBOSE == false))
return;

fprintf(stderr, ">>%s<<\t", loglevel2str[loglevel]);
fprintf(stderr, ">>%s<<\t", loglevel2str(loglevel));

va_start(arg, format);
vfprintf(stderr, format, arg);
Expand Down
1 change: 1 addition & 0 deletions libs/rMlib/include/Input.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "MathUtil.h"

#include <algorithm>
#include <array>
#include <chrono>
#include <memory>
#include <optional>
Expand Down
32 changes: 16 additions & 16 deletions tools/input-test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,22 @@ printEvent(const KeyEvent& ev) {

int
main() {
// struct udev* udev = udev_new();
// if (!udev) {
// fprintf(stderr, "udev_new() failed\n");
// return 1;
// }

// enumerate_devices(udev);
// monitor_devices(udev);

// udev_unref(udev);

// auto deviceType = device::getDeviceType();
// if (deviceType.isError()) {
// std::cerr << "Unknown device\n";
// return -1;
// }
struct udev* udev = udev_new();
if (!udev) {
fprintf(stderr, "udev_new() failed\n");
return 1;
}

enumerate_devices(udev);
monitor_devices(udev);

udev_unref(udev);

auto deviceType = device::getDeviceType();
if (deviceType.isError()) {
std::cerr << "Unknown device\n";
return -1;
}

InputManager input;
auto err = input.openAll();
Expand Down

0 comments on commit 97a35cb

Please sign in to comment.