google / sandboxed-api

Generate sandboxes for C/C++ libraries automatically
https://developers.google.com/sandboxed-api/
Apache License 2.0
1.65k stars 189 forks source link

Fix for #154 doesn’t work for return values #158

Closed DemiMarie closed 2 years ago

DemiMarie commented 2 years ago

The fix for #154 doesn’t work for functions that return _Bool. I still need a typedef bool _Bool; in the libzip contrib.

cblichmann commented 2 years ago

That's odd, I tested this with:

extern _Bool MyFunc() { return 0; }

The generator correctly outputs this method:

  // ...
  // _Bool MyFunc()
  ::absl::StatusOr<bool> MyFunc() {
    ::sapi::v::Bool v_ret_;

    SAPI_RETURN_IF_ERROR(sandbox_->Call("MyFunc", &v_ret_));
    return v_ret_.GetValue();
  }
  // ...

I also don't see any reference to _Bool in libzip. A quick grep -R _Bool in libzip's source directory comes back empty.

DemiMarie commented 2 years ago

Looks like a stale header or something. In any case I cannot reproduce it.

I also don't see any reference to _Bool in libzip. A quick grep -R _Bool in libzip's source directory comes back empty.

Not surprised; <stdbool.h> contains #define bool _Bool.