[Barrelfish-users] About ump_impl.h

Simon Gerber simon.gerber at inf.ethz.ch
Mon Feb 2 15:58:32 CET 2015


Hi Tom,

See the attached patch (0001-ump_impl.patch) for fixing these two issues. A minor correction: the error you are getting about the missing cast is not about dropping the volatile type qualifier, but rather about C++ not allowing implicit casts from void* to typed pointers (which is fine in C).

You may have to apply the second patch (0002-slab_alloc.patch) as well, as we currently have a C function in the core library OS which shadows a C++ constructor when compiling the header files into a C++ program.

Note that these patches don't guarantee that every public header just works(tm) when compiled into a C++ program, as we are first and foremost a C project and C++ support is not considered complete at this point.

Best,
-- Simon

On 02.02.2015 08:15, tomsun.0.7 wrote:
> Hi,
> 
> I am the one who is porting applications to Barrelfish. Again, I come across some problems on C++ compatibility.
> 
> At first, I tried test program for e1000 driver, and it worked well. However, when I port an application using this driver, I found something awful:
> 
>      
> 
>     ../include/barrelfish/ump_impl.h: In function ‘errval_t ump_chan_state_init(ump_chan_state*, volatile void*, size_t, ump_direction)’:
> 
>     ../include/barrelfish/ump_impl.h:127:12: error: *invalid conversion* from ‘*volatile void**’ to ‘*volatile ump_message**’ [-fpermissive]
> 
>          c->buf = buf;
> 
>                 ^
> 
>     ../include/barrelfish/ump_impl.h: In function ‘volatile ump_message* ump_impl_poll(ump_chan_state*)’:
> 
>     ../include/barrelfish/ump_impl.h:152:53: error: *no matching function* for call to ‘*ump_control::ump_control(volatile ump_control&)*’
> 
>          struct ump_control ctrl = c->buf[c->pos].header.control;
> 
>                                                          ^
> 
> In a word, C++ thinks *it is dangerous to cast a volatile type into a non-volatile type* and I think so, too.
> 
> So, is there any elegant solution to solve this problem?
> Looking forward to your kind reply, thanks a lot!
> 
> Tom
> 
> 
> 
> _______________________________________________
> Barrelfish-users mailing list
> Barrelfish-users at lists.inf.ethz.ch
> https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ump_impl.patch
Type: text/x-patch
Size: 1311 bytes
Desc: not available
Url : https://lists.inf.ethz.ch/pipermail/barrelfish-users/attachments/20150202/4175e9d0/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-slab_alloc.patch
Type: text/x-patch
Size: 13794 bytes
Desc: not available
Url : https://lists.inf.ethz.ch/pipermail/barrelfish-users/attachments/20150202/4175e9d0/attachment-0001.bin 


More information about the Barrelfish-users mailing list