r-lib / ps

R package to query, list, manipulate system processes
https://ps.r-lib.org/
Other
77 stars 19 forks source link

api-macos.c: fix missing stdbool #135

Closed barracuda156 closed 1 year ago

barracuda156 commented 1 year ago

Adds a missing header.

gaborcsardi commented 1 year ago

Thanks! Why do we actually need this?

barracuda156 commented 1 year ago

Thanks! Why do we actually need this?

It failed otherwise on Mac (either with GCC locally or with Clang on buildbots, I do not remember now, need to reproduce).

barracuda156 commented 1 year ago

@gaborcsardi Ok, because of this:

api-macos.c:823:8: error: unknown type name 'bool'
  823 | static bool ps_in_shared_region(mach_vm_address_t addr, cpu_type_t type) {
      |        ^~~~
api-macos.c: In function 'ps_in_shared_region':
api-macos.c:841:12: error: 'false' undeclared (first use in this function)
  841 |     return false;
      |            ^~~~~
api-macos.c:23:1: note: 'false' is defined in header '<stdbool.h>'; did you forget to '#include <stdbool.h>'?
   22 | #include "arch/macos/process_info.h"
  +++ |+#include <stdbool.h>
   23 | 
api-macos.c:841:12: note: each undeclared identifier is reported only once for each function it appears in
  841 |     return false;
      |            ^~~~~
make: *** [api-macos.o] Error 1
ERROR: compilation failed for package ‘ps’
gaborcsardi commented 1 year ago

I don't see this. On what macOS version? What compiler version?

barracuda156 commented 1 year ago

I don't see this. On what macOS version? What compiler version?

10.6.8, gcc 12.2.0

It was confirmed not to break the build on macOS 11 and macOS 12 with Clangs too (on Macports buildbots). I am not sure if Clang requires that header or it is optional with it.

gaborcsardi commented 1 year ago

Thanks! stdbool.h is C99, so we can add it.

barracuda156 commented 1 year ago

@gaborcsardi Thank you!