Skip to content

Commit

Permalink
subprocess: avoid enum in subprocess_manager_set
Browse files Browse the repository at this point in the history
Change prototype of subprocess_manager_set() to avoid using an enum
as the argument passed to va_start(), as this causes warnings on newer
compilers which complain about

      passing an object that undergoes default argument promotion
      to 'va_start' has undefined behavior [-Werror,-Wvarargs]

The enum undergoes default promotion, and thus it may cause undefined
behavior. Therefore, change the enum argument to an integer to avoid
this warning.
  • Loading branch information
grondo committed Sep 8, 2017
1 parent 71a46ad commit 381cfc7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/common/libsubprocess/subprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ subprocess_manager_reap_all (struct subprocess_manager *sm)
}

int
subprocess_manager_set (struct subprocess_manager *sm, sm_item_t item, ...)
subprocess_manager_set (struct subprocess_manager *sm, int item, ...)
{
va_list ap;

Expand Down
3 changes: 1 addition & 2 deletions src/common/libsubprocess/subprocess.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ struct subprocess_manager * subprocess_manager_create (void);
/*
* Set value for item [item] in subprocess manager [sm]
*/
int subprocess_manager_set (struct subprocess_manager *sm,
sm_item_t item, ...);
int subprocess_manager_set (struct subprocess_manager *sm, int item, ...);

/*
* Free memory associated with a subprocess manager object:
Expand Down

0 comments on commit 381cfc7

Please sign in to comment.