Validate acc_device_t uses
authorFrederik Harwath <frederik@codesourcery.com>
Tue, 3 Dec 2019 14:38:54 +0000 (14:38 +0000)
committerFrederik Harwath <frederik@gcc.gnu.org>
Tue, 3 Dec 2019 14:38:54 +0000 (14:38 +0000)
commitd8f0024b57e261f0466b2b206d459ad05ab7ca1c
treebd804418fd3de6af0c1bbb21d7bcc8f1344927bd
parent83caa34e2a618842e05f59cbb3e2dda93dc23270
Validate acc_device_t uses

Check that function arguments of type acc_device_t
are valid enumeration values in all publicly visible
functions from oacc-init.c.

2019-12-03  Frederik Harwath  <frederik@codesourcery.com>

libgomp/
* oacc-init.c (acc_known_device_type): Add function.
(unknown_device_type_error): Add function.
  (name_of_acc_device_t): Change to call unknown_device_type_error
on unknown type.
(resolve_device): Use acc_known_device_type.
  (acc_init): Fail if acc_device_t argument is not valid.
  (acc_shutdown): Likewise.
  (acc_get_num_devices): Likewise.
  (acc_set_device_type): Likewise.
(acc_get_device_num): Likewise.
(acc_set_device_num): Likewise.
  (acc_on_device): Add comment that argument validity is not checked.

Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
From-SVN: r278937
libgomp/ChangeLog
libgomp/oacc-init.c