Skip to content

Commit b2a9785

Browse files
committed
Don't allow improper_ctypes
Most of what this crate does is interact with C, so the lint should be useful. It can be disabled on a case-by-case basis as needed. There are a few fixes needed for enums, which will be going away anyway (#4419). Additionally, switch the `bad_style` lint to the newer name `nonstandard_style`.
1 parent b94681f commit b2a9785

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
#![allow(
55
renamed_and_removed_lints, // Keep this order.
66
unknown_lints, // Keep this order.
7-
bad_style,
7+
nonstandard_style,
88
overflowing_literals,
9-
improper_ctypes,
109
unused_macros,
1110
unused_macro_rules,
1211
)]

src/unix/haiku/native.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pub type image_id = i32;
4848

4949
e! {
5050
// kernel/OS.h
51+
#[repr(C)]
5152
pub enum thread_state {
5253
B_THREAD_RUNNING = 1,
5354
B_THREAD_READY,
@@ -58,6 +59,7 @@ e! {
5859
}
5960

6061
// kernel/image.h
62+
#[repr(C)]
6163
pub enum image_type {
6264
B_APP_IMAGE = 1,
6365
B_LIBRARY_IMAGE,
@@ -67,6 +69,7 @@ e! {
6769

6870
// kernel/scheduler.h
6971

72+
#[repr(C)]
7073
pub enum be_task_flags {
7174
B_DEFAULT_MEDIA_PRIORITY = 0x000,
7275
B_OFFLINE_PROCESSING = 0x001,
@@ -83,12 +86,14 @@ e! {
8386
B_MIDI_PROCESSING = 0x800,
8487
}
8588

89+
#[repr(C)]
8690
pub enum schduler_mode {
8791
SCHEDULER_MODE_LOW_LATENCY,
8892
SCHEDULER_MODE_POWER_SAVING,
8993
}
9094

9195
// FindDirectory.h
96+
#[repr(C)]
9297
pub enum path_base_directory {
9398
B_FIND_PATH_INSTALLATION_LOCATION_DIRECTORY,
9499
B_FIND_PATH_ADD_ONS_DIRECTORY,
@@ -118,6 +123,7 @@ e! {
118123
B_FIND_PATH_PACKAGE_PATH,
119124
}
120125

126+
#[repr(C)]
121127
pub enum directory_which {
122128
B_DESKTOP_DIRECTORY = 0,
123129
B_TRASH_DIRECTORY,
@@ -203,6 +209,7 @@ e! {
203209

204210
// kernel/OS.h
205211

212+
#[repr(C)]
206213
pub enum topology_level_type {
207214
B_TOPOLOGY_UNKNOWN,
208215
B_TOPOLOGY_ROOT,
@@ -211,6 +218,7 @@ e! {
211218
B_TOPOLOGY_PACKAGE,
212219
}
213220

221+
#[repr(C)]
214222
pub enum cpu_platform {
215223
B_CPU_UNKNOWN,
216224
B_CPU_x86,
@@ -227,6 +235,7 @@ e! {
227235
B_CPU_RISC_V,
228236
}
229237

238+
#[repr(C)]
230239
pub enum cpu_vendor {
231240
B_CPU_VENDOR_UNKNOWN,
232241
B_CPU_VENDOR_AMD,

src/unix/linux_like/linux/uclibc/x86_64/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4;
334334

335335
cfg_if! {
336336
if #[cfg(target_os = "l4re")] {
337+
#[allow(improper_ctypes)] // FIXME(l4re): this shouldn't be needed
337338
mod l4re;
338339
pub use self::l4re::*;
339340
} else {

0 commit comments

Comments
 (0)