You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4129 Reporter:@oandrieu Assigned to:@damiendoligez Status: closed (set by @damiendoligez on 2006-11-17T15:40:22Z) Resolution: fixed Priority: normal Severity: minor Version: 3.09.3 Fixed in version: 3.09.4+dev / +rc Category: ~DO NOT USE (was: OCaml general)
Bug description
The new definition of CAMLreturn in 3.09.3 (cf. bug #4068) assumes that the returned values is of type value. When CAMLreturn is used in a function that returns a pointer type, the C compiler emits an annoying warning:
,----
| warning: initialization makes integer from pointer without a cast
| warning: return makes pointer from integer without a cast
`----
The text was updated successfully, but these errors were encountered:
gcc has a typeof construct http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Typeof.html#Typeof , so we could define CAMLreturn as:
,----
| #define CAMLreturn(result) do{
| typeof (result) caml__temp_result = (result);
| caml_local_roots = caml__frame;
| return (caml__temp_result);
| }while(0)
`----
But we need something that works for all compilers.
How about adding a type argument to the macro ?
,----
| #define CAMLreturnT(T, result) do{
| T caml__temp_result = (result);
| caml_local_roots = caml__frame;
| return (caml__temp_result);
| }while(0)
|
| #define CAMLreturn(result) CAMLreturnT(value, result)
`----
Original bug ID: 4129
Reporter: @oandrieu
Assigned to: @damiendoligez
Status: closed (set by @damiendoligez on 2006-11-17T15:40:22Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.09.3
Fixed in version: 3.09.4+dev / +rc
Category: ~DO NOT USE (was: OCaml general)
Bug description
The new definition of CAMLreturn in 3.09.3 (cf. bug #4068) assumes that the returned values is of type value. When CAMLreturn is used in a function that returns a pointer type, the C compiler emits an annoying warning:
,----
| warning: initialization makes integer from pointer without a cast
| warning: return makes pointer from integer without a cast
`----
The text was updated successfully, but these errors were encountered: