Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions contrib/check_unnecessary_headers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,18 @@ SEARCH_HEADER[30]="opal/util/convert.h opal_size2int"
SEARCH_HEADER[31]="opal/util/daemon_init.h opal_daemon_init"
SEARCH_HEADER[32]="opal/util/error.h opal_perror opal_strerror opal_strerror_r opal_err2str_fn_t opal_error_register"
SEARCH_HEADER[33]="opal/util/if.h IF_NAMESIZE opal_ifnametoaddr opal_ifaddrtoname opal_ifnametoindex opal_ifnametokindex opal_ifindextokindex opal_ifcount opal_ifbegin opal_ifnext opal_ifindextoname opal_ifkindextoname opal_ifindextoaddr opal_ifindextomask opal_ifindextoflags opal_ifislocal opal_iffinalize"
SEARCH_HEADER[34]="opal/util/net.h opal_net_init opal_net_finalize opal_net_prefix2netmask opal_net_islocalhost opal_net_samenetwork opal_net_addr_isipv4public opal_net_get_hostname opal_net_get_port"
SEARCH_HEADER[35]="opal/util/opal_environ.h opal_environ_merge opal_setenv opal_unsetenv opal_home_directory opal_tmp_directory environ"
SEARCH_HEADER[36]="opal/util/opal_getcwd.h opal_getcwd"
SEARCH_HEADER[37]="opal/util/os_dirpath.h opal_os_dirpath_create opal_os_dirpath_is_empty opal_os_dirpath_access opal_os_dirpath_destroy"
SEARCH_HEADER[38]="opal/util/os_path.h opal_os_path opal_make_filename_os_friendly"
SEARCH_HEADER[39]="opal/util/output.h opal_output_stream_t opal_output_init opal_output_finalize opal_output_open opal_output_reopen opal_output_switch opal_output_reopen_all opal_output_close opal_output opal_output_verbose opal_output_vverbose opal_output_string opal_output_vstring opal_output_set_verbosity opal_output_get_verbosity opal_output_set_output_file_info OPAL_OUTPUT OPAL_OUTPUT_VERBOSE"
SEARCH_HEADER[40]="opal/util/path.h opal_path_find opal_path_findv opal_path_is_absolute opal_find_absolute_path opal_path_access"
SEARCH_HEADER[41]="opal/util/printf.h snprintf vsnprintf"
SEARCH_HEADER[42]="opal/util/show_help.h opal_show_help_init opal_show_help_finalize opal_show_help opal_show_vhelp opal_show_help_string opal_show_help_finish_parsing"
SEARCH_HEADER[43]="opal/util/strncpy.h opal_strncpy"
SEARCH_HEADER[44]=""
SEARCH_HEADER[34]="opal/util/misc.h container_of"
SEARCH_HEADER[35]="opal/util/net.h opal_net_init opal_net_finalize opal_net_prefix2netmask opal_net_islocalhost opal_net_samenetwork opal_net_addr_isipv4public opal_net_get_hostname opal_net_get_port"
SEARCH_HEADER[36]="opal/util/opal_environ.h opal_environ_merge opal_setenv opal_unsetenv opal_home_directory opal_tmp_directory environ"
SEARCH_HEADER[37]="opal/util/opal_getcwd.h opal_getcwd"
SEARCH_HEADER[38]="opal/util/os_dirpath.h opal_os_dirpath_create opal_os_dirpath_is_empty opal_os_dirpath_access opal_os_dirpath_destroy"
SEARCH_HEADER[39]="opal/util/os_path.h opal_os_path opal_make_filename_os_friendly"
SEARCH_HEADER[40]="opal/util/output.h opal_output_stream_t opal_output_init opal_output_finalize opal_output_open opal_output_reopen opal_output_switch opal_output_reopen_all opal_output_close opal_output opal_output_verbose opal_output_vverbose opal_output_string opal_output_vstring opal_output_set_verbosity opal_output_get_verbosity opal_output_set_output_file_info OPAL_OUTPUT OPAL_OUTPUT_VERBOSE"
SEARCH_HEADER[41]="opal/util/path.h opal_path_find opal_path_findv opal_path_is_absolute opal_find_absolute_path opal_path_access"
SEARCH_HEADER[42]="opal/util/printf.h snprintf vsnprintf"
SEARCH_HEADER[43]="opal/util/show_help.h opal_show_help_init opal_show_help_finalize opal_show_help opal_show_vhelp opal_show_help_string opal_show_help_finish_parsing"
SEARCH_HEADER[44]="opal/util/strncpy.h opal_strncpy"
SEARCH_HEADER[45]=""

delete_unnessary_header .

Expand Down
1 change: 1 addition & 0 deletions ompi/mca/mtl/ofi/mtl_ofi.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "ompi/mca/mtl/mtl.h"
#include "ompi/mca/mtl/base/base.h"
#include "opal/datatype/opal_convertor.h"
#include "opal/util/misc.h"
#include "opal/util/show_help.h"
#include "opal/util/printf.h"

Expand Down
5 changes: 1 addition & 4 deletions opal/mca/btl/usnic/btl_usnic.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "opal/class/opal_hash_table.h"
#include "opal/util/alfg.h"
#include "opal/util/event.h"
#include "opal/util/misc.h"
#include "opal_stdint.h"

#include "opal/mca/btl/base/base.h"
Expand Down Expand Up @@ -65,10 +66,6 @@ static inline uint64_t get_ticks(void)
/* RNG buffer declaration */
extern opal_rng_buff_t opal_btl_usnic_rand_buff;

#ifndef container_of
# define container_of(ptr, type, member) ((type *) (((char *) (ptr)) - offsetof(type, member)))
#endif

#ifndef max
# define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
Expand Down
1 change: 1 addition & 0 deletions opal/util/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ headers = \
if.h \
keyval_parse.h \
malloc.h \
misc.h \
net.h \
numtostr.h \
opal_environ.h \
Expand Down
5 changes: 1 addition & 4 deletions opal/util/bipartite_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@
#include "opal/class/opal_pointer_array.h"
#include "opal/constants.h"
#include "opal/util/error.h"
#include "opal/util/misc.h"
#include "opal/util/output.h"
#include "opal_stdint.h"

#include "opal/util/bipartite_graph.h"
#include "opal/util/bipartite_graph_internal.h"

#ifndef container_of
# define container_of(ptr, type, member) ((type *) (((char *) (ptr)) - offsetof(type, member)))
#endif

#define GRAPH_DEBUG 0
#if GRAPH_DEBUG
# define GRAPH_DEBUG_OUT(args) printf(args)
Expand Down
27 changes: 27 additions & 0 deletions opal/util/misc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2024 Amazon.com, Inc. or its affiliates.
* All Rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/

/** @file:
* Miscellaneous utilities
*/

#ifndef OPAL_UTIL_MISC_H
#define OPAL_UTIL_MISC_H

#include "opal/include/opal_config.h"

BEGIN_C_DECLS

#ifndef container_of
# define container_of(ptr, type, member) ((type *) (((char *) (ptr)) - offsetof(type, member)))
#endif

END_C_DECLS
#endif