Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
felixmoebius
libc
Commits
90d86148
Unverified
Commit
90d86148
authored
6 years ago
by
Isaac Woods
Browse files
Options
Downloads
Patches
Plain Diff
De-duplicate c_cvoid definitions
parent
2926a5bb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib.rs
+22
-18
22 additions, 18 deletions
src/lib.rs
src/switch.rs
+0
-18
0 additions, 18 deletions
src/switch.rs
with
22 additions
and
36 deletions
src/lib.rs
+
22
−
18
View file @
90d86148
...
@@ -101,6 +101,28 @@ extern crate std as core;
...
@@ -101,6 +101,28 @@ extern crate std as core;
#[macro_use]
mod
macros
;
#[macro_use]
mod
macros
;
mod
dox
;
mod
dox
;
/*
* `c_void` should be defined for all targets except wasm.
*/
#[cfg(not(all(target_arch
=
"wasm32"
,
not(target_os
=
"emscripten"
))))]
cfg_if!
{
if
#[cfg(core_cvoid)]
{
pub
use
core
::
ffi
::
c_void
;
}
else
{
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
// more optimization opportunities around it recognizing things like
// malloc/free.
#[repr(u8)]
pub
enum
c_void
{
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
__variant1
,
#[doc(hidden)]
__variant2
,
}
}
}
cfg_if!
{
cfg_if!
{
if
#[cfg(all(target_arch
=
"wasm32"
,
not(target_os
=
"emscripten"
)))]
{
if
#[cfg(all(target_arch
=
"wasm32"
,
not(target_os
=
"emscripten"
)))]
{
// empty ...
// empty ...
...
@@ -108,24 +130,6 @@ cfg_if! {
...
@@ -108,24 +130,6 @@ cfg_if! {
// On the Switch, we only define some useful universal types for
// On the Switch, we only define some useful universal types for
// convenience. Those can be found in the switch.rs file.
// convenience. Those can be found in the switch.rs file.
}
else
{
}
else
{
cfg_if!
{
if
#[cfg(core_cvoid)]
{
pub
use
core
::
ffi
::
c_void
;
}
else
{
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
// more optimization opportunities around it recognizing things like
// malloc/free.
#[repr(u8)]
pub
enum
c_void
{
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
__variant1
,
#[doc(hidden)]
__variant2
,
}
}
}
pub
type
int8_t
=
i8
;
pub
type
int8_t
=
i8
;
pub
type
int16_t
=
i16
;
pub
type
int16_t
=
i16
;
pub
type
int32_t
=
i32
;
pub
type
int32_t
=
i32
;
...
...
This diff is collapsed.
Click to expand it.
src/switch.rs
+
0
−
18
View file @
90d86148
...
@@ -34,21 +34,3 @@ pub type c_char = u8;
...
@@ -34,21 +34,3 @@ pub type c_char = u8;
pub
type
c_long
=
i64
;
pub
type
c_long
=
i64
;
pub
type
c_ulong
=
u64
;
pub
type
c_ulong
=
u64
;
pub
type
wchar_t
=
u32
;
pub
type
wchar_t
=
u32
;
cfg_if!
{
if
#[cfg(core_cvoid)]
{
pub
use
core
::
ffi
::
c_void
;
}
else
{
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
// enable more optimization opportunities around it recognizing things
// like malloc/free.
#[repr(u8)]
pub
enum
c_void
{
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
__variant1
,
#[doc(hidden)]
__variant2
,
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment