Skip to content

Commit fcecbf0

Browse files
authored
Merge pull request #84 from madsmtm/various-small-fixes
Various fixes
2 parents 136aa69 + dfa8383 commit fcecbf0

File tree

19 files changed

+173
-72
lines changed

19 files changed

+173
-72
lines changed

.github/workflows/gnustep.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/checkout@v2
2424

2525
- name: Install Clang
26-
run: sudo apt-get install clang
26+
run: sudo apt-get -y install clang
2727

2828
- name: Cache GNUStep
2929
id: cache-gnustep
@@ -53,9 +53,9 @@ jobs:
5353
echo "CPATH=$HOME/gnustep/include:$CPATH" >> $GITHUB_ENV
5454
ls -al ~/gnustep/* || true # Ignore failures
5555
56-
- name: Install Make
56+
- name: Install Make and Cmake
5757
if: steps.cache-gnustep.outputs.cache-hit != 'true'
58-
run: sudo apt-get install make
58+
run: sudo apt-get -y install make cmake
5959

6060
- name: Install GNUStep libobjc2
6161
if: steps.cache-gnustep.outputs.cache-hit != 'true'

block2/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct. For example, to create a block that adds two `i32`s, we could write:
4343
use block2::ConcreteBlock;
4444
let block = ConcreteBlock::new(|a: i32, b: i32| a + b);
4545
let block = block.copy();
46-
assert!(unsafe { block.call((5, 8)) } == 13);
46+
assert_eq!(unsafe { block.call((5, 8)) }, 13);
4747
```
4848

4949
It is important to copy your block to the heap (with the `copy` method) before

block2/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct. For example, to create a block that adds two `i32`s, we could write:
3636
# use block2::ConcreteBlock;
3737
let block = ConcreteBlock::new(|a: i32, b: i32| a + b);
3838
let block = block.copy();
39-
assert!(unsafe { block.call((5, 8)) } == 13);
39+
assert_eq!(unsafe { block.call((5, 8)) }, 13);
4040
```
4141
4242
It is important to copy your block to the heap (with the `copy` method) before

objc-sys/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1010
* `NSInteger` and `NSUInteger` (type aliases of `isize`/`usize`).
1111
* `NSIntegerMax`, `NSIntegerMin` and `NSUIntegerMax`.
1212

13+
### Changed
14+
* **BREAKING**: `cfg`-guarded `class_getImageName` to only appear on Apple
15+
platforms.
16+
17+
This is a breaking change, but it will be allowed in a semver-compatible
18+
release, since it is unlikely that anyone is using it, and the symbol is not
19+
present on other platforms anyhow, so users will just get an error at
20+
link-time.
21+
1322

1423
## 0.1.0 - 2021-11-22
1524

objc-sys/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,16 @@ runtimes, since support for reference-counting primitives like `objc_retain`
7070
and `objc_autoreleasePoolPop` is a vital requirement for most applications.
7171

7272
Just so we're being clear, this rules out the GCC [`libobjc`][gcc-libobjc]
73-
runtime (see [this][gcc-objc-support]), and the [`mulle-objc`] runtime. (But
74-
support for [`ObjFW`] may be added). More information on different runtimes
75-
can be found in GNUStep's [Objective-C Compiler and Runtime FAQ][gnustep-faq].
73+
runtime (see [this][gcc-objc-support]), the [`mulle-objc`] runtime and
74+
[cocotron]. (But support for [`ObjFW`] may be added).
75+
More information on different runtimes can be found in GNUStep's
76+
[Objective-C Compiler and Runtime FAQ][gnustep-faq].
7677

7778
[modern]: https://en.wikipedia.org/wiki/Objective-C#Modern_Objective-C
7879
[gcc-libobjc]: https://github.com/gcc-mirror/gcc/tree/master/libobjc
7980
[gcc-objc-support]: https://gcc.gnu.org/onlinedocs/gcc/Standards.html#Objective-C-and-Objective-C_002b_002b-Languages
8081
[`mulle-objc`]: https://github.com/mulle-objc/mulle-objc-runtime
82+
[cocotron]: https://cocotron.org/
8183
[`ObjFW`]: https://github.com/ObjFW/ObjFW
8284
[gnustep-faq]: http://wiki.gnustep.org/index.php/Objective-C_Compiler_and_Runtime_FAQ
8385

objc-sys/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,12 @@ fn main() {
200200
// Add CC arguments
201201
// Assume the compiler is clang; if it isn't, this is probably going to
202202
// fail anyways, since we're using newer runtimes than GCC supports.
203+
//
204+
// TODO: Should add we these, or is it someone else's responsibility?
205+
// - `-mios-simulator-version-min={}`
206+
// - `-miphoneos-version-min={}`
207+
// - `-mmacosx-version-min={}`
208+
// - ...
203209
println!(
204210
"cargo:cc_args=-fobjc-arc -fobjc-arc-exceptions -fobjc-exceptions -fobjc-runtime={}",
205211
// TODO: -fobjc-weak ?

objc-sys/src/class.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ extern "C" {
9090
name: *const objc_selector,
9191
) -> *const objc_method;
9292
pub fn class_getClassVariable(cls: *const objc_class, name: *const c_char) -> *const objc_ivar;
93+
#[cfg(apple)]
9394
pub fn class_getImageName(cls: *const objc_class) -> *const c_char;
9495
pub fn class_getInstanceMethod(
9596
cls: *const objc_class,

objc2-encode/src/encoding.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ mod tests {
198198
let i = Encoding::Int;
199199
let p = Encoding::Pointer(&Encoding::Int);
200200

201-
assert!(p == p);
202-
assert!(p != i);
201+
assert_eq!(p, p);
202+
assert_ne!(p, i);
203203
}
204204

205205
#[test]
@@ -213,8 +213,8 @@ mod tests {
213213
let i = Encoding::Int;
214214
let c = Encoding::Char;
215215

216-
assert!(i == i);
217-
assert!(i != c);
216+
assert_eq!(i, i);
217+
assert_ne!(i, c);
218218
}
219219

220220
#[test]
@@ -227,8 +227,8 @@ mod tests {
227227
#[test]
228228
fn test_struct_eq() {
229229
let s = Encoding::Struct("CGPoint", &[Encoding::Char, Encoding::Int]);
230-
assert!(s == s);
231-
assert!(s != Encoding::Int);
230+
assert_eq!(s, s);
231+
assert_ne!(s, Encoding::Int);
232232
}
233233

234234
#[test]
@@ -241,7 +241,7 @@ mod tests {
241241
#[test]
242242
fn test_union_eq() {
243243
let u = Encoding::Union("Onion", &[Encoding::Char, Encoding::Int]);
244-
assert!(u == u);
245-
assert!(u != Encoding::Int);
244+
assert_eq!(u, u);
245+
assert_ne!(u, Encoding::Int);
246246
}
247247
}

objc2-foundation/src/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ mod tests {
428428
fn test_iter() {
429429
let array = sample_array(4);
430430

431-
assert!(array.iter().count() == 4);
431+
assert_eq!(array.iter().count(), 4);
432432
assert!(array
433433
.iter()
434434
.enumerate()

objc2-foundation/src/enumerator.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,9 @@ impl<'a, C: INSFastEnumeration> NSFastEnumerator<'a, C> {
133133
if let Some(buf) = next_buf {
134134
// Check if the collection was mutated
135135
if let Some(mutations) = mutations {
136-
assert!(
137-
mutations == unsafe { *self.state.mutations_ptr },
136+
assert_eq!(
137+
mutations,
138+
unsafe { *self.state.mutations_ptr },
138139
"Mutation detected during enumeration of object {:p}",
139140
self.object
140141
);
@@ -178,7 +179,7 @@ mod tests {
178179
let array = NSArray::from_vec(vec);
179180

180181
let enumerator = array.iter();
181-
assert!(enumerator.count() == 4);
182+
assert_eq!(enumerator.count(), 4);
182183

183184
let enumerator = array.iter();
184185
assert!(enumerator.enumerate().all(|(i, obj)| obj.get() == i as u32));
@@ -190,7 +191,7 @@ mod tests {
190191
let array = NSArray::from_vec(vec);
191192

192193
let enumerator = array.enumerator();
193-
assert!(enumerator.count() == 4);
194+
assert_eq!(enumerator.count(), 4);
194195

195196
let enumerator = array.enumerator();
196197
assert!(enumerator.enumerate().all(|(i, obj)| obj.get() == i as u32));

0 commit comments

Comments
 (0)