nickdesaulniers wrote:

[Bionic](https://source.corp.google.com/h/googleplex-android/platform/superproject/main/+/main:external/llvm-libc/src/sys/ptrace/ptrace.h;l=21)
 declares `ptrace` as:

```c++
long ptrace(int request, ...);
```

[musl](https://git.musl-libc.org/cgit/musl/tree/include/sys/ptrace.h#n142) 
declares `ptrace` as:

```c++
long ptrace(int, ...);
```

glibc declares `ptrace` as:

```c++
extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
```
(unable to link to their sources, their server appears to be having trouble).

The issue is in C++, does not allow implicit conversion from an integer to an 
enum (unlike C).  Removing the static_cast then calling glibc's declaration 
triggers:

clang:
```
error: no matching function for call to 'ptrace'
note: candidate function not viable: no known conversion from 'int' to 'enum 
__ptrace_request' for 1st argument
```
gcc:
```
error: invalid conversion from 'int' to '__ptrace_request' [-fpermissive]
```

At the least, I'll keep the change as is, but add a comment and update the 
commit & pr descriptions.

https://github.com/llvm/llvm-project/pull/219237
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to