diff mbox

fixup gomp register/unregister prototypes

Message ID 55A6AEBE.5090406@acm.org
State New
Headers show

Commit Message

Nathan Sidwell July 15, 2015, 7:04 p.m. UTC
I'm almost tempted to commit as obvious.  I noticed that the callers of these 
functions from code generated by mkoffload declare the 2nd arg as an int, 
because they have no visibility of the enum.  I thought it wise to make the 
definitions match.

ok for trunk?

nathan

Comments

Jakub Jelinek July 17, 2015, 2:44 p.m. UTC | #1
On Wed, Jul 15, 2015 at 03:04:30PM -0400, Nathan Sidwell wrote:
> I'm almost tempted to commit as obvious.  I noticed that the callers of
> these functions from code generated by mkoffload declare the 2nd arg as an
> int, because they have no visibility of the enum.  I thought it wise to make
> the definitions match.

I think it doesn't really matter that much, such an enum on all targets we care
about is passed the same way as int.

But if you think it is important, I don't really care either way.

> 2015-07-15  Nathan Sidwell  <nathan@codesourcery.com>
> 
> 	* target.c (GOMP_offload_register): Use int for device type arg.
> 	(GOMP_offload_unregister): Likewise.

	Jakub
Nathan Sidwell July 17, 2015, 3:44 p.m. UTC | #2
On 07/17/15 10:44, Jakub Jelinek wrote:
> On Wed, Jul 15, 2015 at 03:04:30PM -0400, Nathan Sidwell wrote:
>> I'm almost tempted to commit as obvious.  I noticed that the callers of
>> these functions from code generated by mkoffload declare the 2nd arg as an
>> int, because they have no visibility of the enum.  I thought it wise to make
>> the definitions match.
>
> I think it doesn't really matter that much, such an enum on all targets we care
> about is passed the same way as int.
>
> But if you think it is important, I don't really care either way.

Having been bitten by fshort-enums on ARM, I like to be careful :)

nathan
Jakub Jelinek July 17, 2015, 3:48 p.m. UTC | #3
On Fri, Jul 17, 2015 at 11:44:47AM -0400, Nathan Sidwell wrote:
> On 07/17/15 10:44, Jakub Jelinek wrote:
> >On Wed, Jul 15, 2015 at 03:04:30PM -0400, Nathan Sidwell wrote:
> >>I'm almost tempted to commit as obvious.  I noticed that the callers of
> >>these functions from code generated by mkoffload declare the 2nd arg as an
> >>int, because they have no visibility of the enum.  I thought it wise to make
> >>the definitions match.
> >
> >I think it doesn't really matter that much, such an enum on all targets we care
> >about is passed the same way as int.
> >
> >But if you think it is important, I don't really care either way.
> 
> Having been bitten by fshort-enums on ARM, I like to be careful :)

That is an ABI changing option, though perhaps somebody might build libgomp
for that ABI.  Ok then.

	Jakub
diff mbox

Patch

2015-07-15  Nathan Sidwell  <nathan@codesourcery.com>

	* target.c (GOMP_offload_register): Use int for device type arg.
	(GOMP_offload_unregister): Likewise.

Index: target.c
===================================================================
--- target.c	(revision 225843)
+++ target.c	(working copy)
@@ -727,10 +727,11 @@  gomp_offload_image_to_device (struct gom
 
 /* This function should be called from every offload image while loading.
    It gets the descriptor of the host func and var tables HOST_TABLE, TYPE of
-   the target, and TARGET_DATA needed by target plugin.  */
+   the target, and TARGET_DATA needed by target plugin.  TYPE is an
+   int because the caller is not exposed to the enum definition.   */
 
 void
-GOMP_offload_register (void *host_table, enum offload_target_type target_type,
+GOMP_offload_register (void *host_table, int target_type,
 		       void *target_data)
 {
   int i;
@@ -764,7 +765,7 @@  GOMP_offload_register (void *host_table,
    the target, and TARGET_DATA needed by target plugin.  */
 
 void
-GOMP_offload_unregister (void *host_table, enum offload_target_type target_type,
+GOMP_offload_unregister (void *host_table, int target_type,
 			 void *target_data)
 {
   void **host_func_table = ((void ***) host_table)[0];