This is a static archive of the previous Open Grid Forum Redmine content management system saved from host redmine.ogf.org file /issues/255 at Thu, 03 Nov 2022 15:08:39 GMT bug #255: enums must include DRMAA2_UNSET_ENUM - DRMAAv2 C Binding - Open Grid Forum

bug #255

enums must include DRMAA2_UNSET_ENUM

Added by Daniel Gruber over 7 years ago. Updated over 7 years ago.

Status:closed Start date:02/03/2015
Priority:High Due date:
Assignee:- % Done:

0%

Category:-
Target version:-

Description

DRMAA2_UNSET_ENUM is defined as -1 and not part of the ENUMs defined
by the standard. Those are all positive numbers.

Hence some compilers complaining about the tests if a specific
enum value is UNSET. The compiler seems to choose an int for the
ENUM and hence they have different types.

Therefore all enums need to include DRMAA2_UNSET_ENUM as value.
Probably we would need for each enum a different constant name.

History

Updated by Daniel Gruber over 7 years ago

I meant the compiler chooses an unsigned int since all values are positive.

/libs/drmaa2/drmaa2_types.c:95:21: error: comparison of constant -1 with expression of type 'const drmaa2_os' (aka 'const enum drmaa2_os') is always
true [-Werror,-Wtautological-constant-out-of-range-compare] || (os != DRMAA2_UNSET_ENUM && architectures[i].os == os)) {

Updated by Daniel Gruber over 7 years ago

Changing this for the next Univa Grid Engine release. Should be backward compatible since
DRMAA2_UNSET_ENUM is still defined and -1.

/* Constants for boolean values. */
typedef enum drmaa2_bool {
DRMAA2_FALSE = 0,
DRMAA2_TRUE = 1
} drmaa2_bool;

/* Constants for capabilities. */
typedef enum drmaa2_capability {
DRMAA2_UNSET_CAPABILITY = -1,
DRMAA2_ADVANCE_RESERVATION = 0,
DRMAA2_RESERVE_SLOTS = 1,
DRMAA2_CALLBACK = 2,
DRMAA2_BULK_JOBS_MAXPARALLEL = 3,
DRMAA2_JT_EMAIL = 4,
DRMAA2_JT_STAGING = 5,
DRMAA2_JT_DEADLINE = 6,
DRMAA2_JT_MAXSLOTS = 7,
DRMAA2_JT_ACCOUNTINGID = 8,
DRMAA2_RT_STARTNOW = 9,
DRMAA2_RT_DURATION = 10,
DRMAA2_RT_MACHINEOS = 11,
DRMAA2_RT_MACHINEARCH = 12
} drmaa2_capability;

/* Constants for the CPU type. */
typedef enum drmaa2_cpu {
DRMAA2_UNSET_CPU = -1,
DRMAA2_OTHER_CPU = 0,
DRMAA2_ALPHA = 1,
DRMAA2_ARM = 2,
DRMAA2_ARM64 = 3,
DRMAA2_CELL = 4,
DRMAA2_PARISC = 5,
DRMAA2_PARISC64 = 6,
DRMAA2_X86 = 7,
DRMAA2_X64 = 8,
DRMAA2_IA64 = 9,
DRMAA2_MIPS = 10,
DRMAA2_MIPS64 = 11,
DRMAA2_PPC = 12,
DRMAA2_PPC64 = 13,
DRMAA2_SPARC = 14,
DRMAA2_SPARC64 = 15
} drmaa2_cpu;

/* Constants for errors. */
typedef enum drmaa2_error {
DRMAA2_UNSET_ERROR = -1,
DRMAA2_SUCCESS = 0,
DRMAA2_DENIED_BY_DRMS = 1,
DRMAA2_DRM_COMMUNICATION = 2,
DRMAA2_TRY_LATER = 3,
DRMAA2_SESSION_MANAGEMENT = 4,
DRMAA2_TIMEOUT = 5,
DRMAA2_INTERNAL = 6,
DRMAA2_INVALID_ARGUMENT = 7,
DRMAA2_INVALID_SESSION = 8,
DRMAA2_INVALID_STATE = 9,
DRMAA2_OUT_OF_RESOURCE = 10,
DRMAA2_UNSUPPORTED_ATTRIBUTE = 11,
DRMAA2_UNSUPPORTED_OPERATION = 12,
DRMAA2_IMPLEMENTATION_SPECIFIC = 13,
DRMAA2_LASTERROR = 14
} drmaa2_error;

/* Constants for the event interface. */
typedef enum drmaa2_event {
DRMAA2_UNSET_EVEMT = -1,
DRMAA2_NEW_STATE = 0,
DRMAA2_MIGRATED = 1,
DRMAA2_ATTRIBUTE_CHANGE = 2
} drmaa2_event;

/* Constants for list types. */
typedef enum drmaa2_listtype {
DRMAA2_UNSET_LISTTYPE = -1,
DRMAA2_STRINGLIST = 0,
DRMAA2_JOBLIST = 1,
DRMAA2_QUEUEINFOLIST = 2,
DRMAA2_MACHINEINFOLIST = 3,
DRMAA2_SLOTINFOLIST = 4,
DRMAA2_RESERVATIONLIST = 5
} drmaa2_listtype;

/* Constants for the operating system name. */
typedef enum drmaa2_os {
DRMAA2_UNSET_OS = -1,
DRMAA2_OTHER_OS = 0,
DRMAA2_AIX = 1,
DRMAA2_BSD = 2,
DRMAA2_LINUX = 3,
DRMAA2_HPUX = 4,
DRMAA2_IRIX = 5,
DRMAA2_MACOS = 6,
DRMAA2_SUNOS = 7,
DRMAA2_TRU64 = 8,
DRMAA2_UNIXWARE = 9,
DRMAA2_WIN = 10,
DRMAA2_WINNT = 11
} drmaa2_os;

/* Constants for the job state. */
typedef enum drmaa2_jstate {
DRMAA2_UNSET_JSTATE = -1,
DRMAA2_UNDETERMINED = 0,
DRMAA2_QUEUED = 1,
DRMAA2_QUEUED_HELD = 2,
DRMAA2_RUNNING = 3,
DRMAA2_SUSPENDED = 4,
DRMAA2_REQUEUED = 5,
DRMAA2_REQUEUED_HELD = 6,
DRMAA2_DONE = 7,
DRMAA2_FAILED = 8
} drmaa2_jstate;

Updated by Peter Tröger over 7 years ago

This seems to be a very reasonable approach for the (gcc-implementation-specific) problem. Completely agreed.

Updated by Peter Tröger over 7 years ago

  • Status changed from submitted to closed

Fixed in July 2015 errata.

(Other formats not available in this archive.

This is a static archive of the previous Open Grid Forum Redmine content management system saved from host redmine.ogf.org file /issues/255 at Thu, 03 Nov 2022 15:08:41 GMT