Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004129OCamlOCaml generalpublic2006-10-04 20:412006-11-17 16:40
Reporteroandrieu 
Assigned Todoligez 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.09.3 
Target VersionFixed in Version3.09.4+dev / +rc 
Summary0004129: new definition of CAMLreturn produces warnings
DescriptionThe new definition of CAMLreturn in 3.09.3 (cf. bug 0004068) 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
`----
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0003841)
doligez (administrator)
2006-11-15 16:13

If anyone has ideas for dealing with this, I want to hear them.
(0003844)
oandrieu (reporter)
2006-11-16 10:20

- 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)
`----
(0003847)
doligez (administrator)
2006-11-17 15:36
edited on: 2006-11-17 16:39

I've implemented your second suggestion in 3.09 branch.


- Issue History
Date Modified Username Field Change
2006-10-04 20:41 oandrieu New Issue
2006-11-15 16:13 doligez Note Added: 0003841
2006-11-15 16:13 doligez Assigned To => doligez
2006-11-15 16:13 doligez Status new => acknowledged
2006-11-16 10:20 oandrieu Note Added: 0003844
2006-11-17 15:36 doligez Note Added: 0003847
2006-11-17 16:39 doligez Note Edited: 0003847
2006-11-17 16:40 doligez Status acknowledged => closed
2006-11-17 16:40 doligez Resolution open => fixed
2006-11-17 16:40 doligez Fixed in Version => 3.09.4+dev / +rc


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker