Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings when building with GCC #38

Merged
merged 5 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ fn main() {

println!("cargo:rerun-if-changed=src/libmaccel.c");
println!("cargo:rerun-if-changed=../driver/accel.h");
println!("cargo:rerun-if-changed=../driver/accel_rs.h");
println!("cargo:rerun-if-changed=../driver/fixedptc.h");
}
2 changes: 1 addition & 1 deletion cli/src/libmaccel.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../../driver/accel.h"
#include "../../driver/accel_rs.h"
#include "../../driver/fixedptc.h"

extern char *fixedpt_to_str(fixedpt num) { return fixedpt_cstr(num, 5); }
Expand Down
4 changes: 2 additions & 2 deletions cli/src/libmaccel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Params {
pub fn sensitivity(s_in: f32, params: Params) -> f64 {
let s_in: Fixedpt = s_in.into();
let a_factor = unsafe {
c_lib::sensitivity(
c_lib::sensitivity_rs(
s_in.0,
params.sens_mult,
params.accel,
Expand Down Expand Up @@ -93,7 +93,7 @@ mod c_lib {
use std::ffi::c_char;

extern "C" {
pub fn sensitivity(
pub fn sensitivity_rs(
speed_in: i32,
param_sens_mult: i32,
param_accel: i32,
Expand Down
2 changes: 1 addition & 1 deletion driver/accel.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const fixedpt FIXEDPT_ZERO = fixedpt_rconst(0.0);
* in order to get the desired output speed.
*
*/
extern inline fixedpt sensitivity(fixedpt input_speed, fixedpt param_sens_mult,
static inline fixedpt sensitivity(fixedpt input_speed, fixedpt param_sens_mult,
fixedpt param_accel, fixedpt param_offset,
fixedpt param_output_cap) {

Expand Down
7 changes: 7 additions & 0 deletions driver/accel_rs.h
Gnarus-G marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "accel.h"

extern inline fixedpt sensitivity_rs(fixedpt input_speed, fixedpt param_sens_mult,
fixedpt param_accel, fixedpt param_offset,
fixedpt param_output_cap) {
return sensitivity(input_speed, param_sens_mult, param_accel, param_offset, param_output_cap);
}
2 changes: 1 addition & 1 deletion driver/accelk.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "linux/ktime.h"
#include "params.h"

static AccelResult inline accelerate(int x, int y) {
static inline AccelResult accelerate(int x, int y) {
static ktime_t last;
static u64 last_ms = 1;

Expand Down
10 changes: 10 additions & 0 deletions driver/dbg.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#endif

#ifdef __KERNEL__
#ifdef __clang__
Gnarus-G marked this conversation as resolved.
Show resolved Hide resolved
#define dbg_k(fmt, ...) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wstatic-local-in-inline\"") do { \
Expand All @@ -22,6 +23,15 @@
} \
while (0) \
_Pragma("clang diagnostic pop")
#else
#define dbg_k(fmt, ...) \
do { \
if (DEBUG_TEST) \
printk(KERN_INFO "%s:%d:%s(): " #fmt "\n", __FILE__, __LINE__, __func__, \
__VA_ARGS__); \
} \
while (0)
#endif
#endif

#ifndef __KERNEL__
Gnarus-G marked this conversation as resolved.
Show resolved Hide resolved
Expand Down