Skip to content

Commit 4324c00

Browse files
authored
Merge pull request #4716 from rhc54/cmr31/optnone
Add __optnone__ attribute for Clang
2 parents 787a2f5 + 148524f commit 4324c00

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

config/opal_check_attributes.m4

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ dnl University of Stuttgart. All rights reserved.
1111
dnl Copyright (c) 2004-2005 The Regents of the University of California.
1212
dnl All rights reserved.
1313
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
14-
dnl Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
14+
dnl Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved
1515
dnl Copyright (c) 2013 Mellanox Technologies, Inc.
1616
dnl All rights reserved.
1717
dnl Copyright (c) 2015 Research Organization for Information Science
1818
dnl and Technology (RIST). All rights reserved.
19+
dnl Copyright (c) 2017 Intel, Inc. All rights reserved.
1920
dnl $COPYRIGHT$
2021
dnl
2122
dnl Additional copyrights may follow
@@ -221,6 +222,7 @@ AC_DEFUN([OPAL_CHECK_ATTRIBUTES], [
221222
opal_cv___attribute__warn_unused_result=0
222223
opal_cv___attribute__weak_alias=0
223224
opal_cv___attribute__destructor=0
225+
opal_cv___attribute__optnone=0
224226
else
225227
AC_MSG_RESULT([yes])
226228

@@ -556,6 +558,21 @@ AC_DEFUN([OPAL_CHECK_ATTRIBUTES], [
556558
],
557559
[],
558560
[])
561+
562+
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([optnone],
563+
[
564+
void __attribute__ ((__optnone__)) foo(void);
565+
void foo(void) { return ; }
566+
],
567+
[],
568+
[])
569+
570+
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([extension],
571+
[
572+
int i = __extension__ 3;
573+
],
574+
[],
575+
[])
559576
fi
560577

561578
# Now that all the values are set, define them
@@ -608,4 +625,8 @@ AC_DEFUN([OPAL_CHECK_ATTRIBUTES], [
608625
[Whether your compiler has __attribute__ weak alias or not])
609626
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_DESTRUCTOR, [$opal_cv___attribute__destructor],
610627
[Whether your compiler has __attribute__ destructor or not])
628+
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_OPTNONE, [$opal_cv___attribute__optnone],
629+
[Whether your compiler has __attribute__ optnone or not])
630+
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_EXTENSION, [$opal_cv___attribute__extension],
631+
[Whether your compiler has __attribute__ extension or not])
611632
])

opal/include/opal_config_bottom.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* All rights reserved.
1616
* Copyright (c) 2015-2017 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
18-
* Copyright (c) 2015 Intel, Inc. All rights reserved.
18+
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
1919
* $COPYRIGHT$
2020
*
2121
* Additional copyrights may follow
@@ -234,6 +234,18 @@
234234
# define __opal_attribute_destructor__
235235
#endif
236236

237+
#if OPAL_HAVE_ATTRIBUTE_OPTNONE
238+
# define __opal_attribute_optnone__ __attribute__((__optnone__))
239+
#else
240+
# define __opal_attribute_optnone__
241+
#endif
242+
243+
#if OPAL_HAVE_ATTRIBUTE_EXTENSION
244+
# define __opal_attribute_extension__ __extension__
245+
#else
246+
# define __opal_attribute_extension__
247+
#endif
248+
237249
# if OPAL_C_HAVE_VISIBILITY
238250
# define OPAL_DECLSPEC __opal_attribute_visibility__("default")
239251
# define OPAL_MODULE_DECLSPEC __opal_attribute_visibility__("default")
@@ -268,11 +280,11 @@
268280
#include <sys/param.h>
269281
#endif
270282
#if defined(PATH_MAX)
271-
#define OPAL_PATH_MAX (PATH_MAX + 1)
283+
#define OPAL_PATH_MAX (PATH_MAX + 1)
272284
#elif defined(_POSIX_PATH_MAX)
273-
#define OPAL_PATH_MAX (_POSIX_PATH_MAX + 1)
285+
#define OPAL_PATH_MAX (_POSIX_PATH_MAX + 1)
274286
#else
275-
#define OPAL_PATH_MAX 256
287+
#define OPAL_PATH_MAX 256
276288
#endif
277289

278290
/*

orte/orted/orted_submit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ char MPIR_attach_fifo[MPIR_MAX_PATH_LENGTH] = {0};
173173
int MPIR_force_to_main = 0;
174174
static void orte_debugger_init_before_spawn(orte_job_t *jdata);
175175

176-
ORTE_DECLSPEC void* MPIR_Breakpoint(void);
176+
ORTE_DECLSPEC void* __opal_attribute_optnone__ MPIR_Breakpoint(void);
177177

178178
/*
179179
* Breakpoint function for parallel debuggers

0 commit comments

Comments
 (0)