Home | History | Annotate | Download | only in include
      1 /*
      2  * Copyright (c) 2016 Cyril Hrubis <chrubis (at) suse.cz>
      3  * Copyright (c) 2013 Stanislav Kholmanskikh <stanislav.kholmanskikh (at) oracle.com>
      4  * Copyright (c) 2010 Ngie Cooper <yaneurabeya (at) gmail.com>
      5  * Copyright (c) 2008 Mike Frysinger <vapier (at) gmail.com>
      6  *
      7  * This program is free software: you can redistribute it and/or modify
      8  * it under the terms of the GNU General Public License as published by
      9  * the Free Software Foundation, either version 2 of the License, or
     10  * (at your option) any later version.
     11  *
     12  * This program is distributed in the hope that it will be useful,
     13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  * GNU General Public License for more details.
     16  *
     17  * You should have received a copy of the GNU General Public License
     18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
     19  */
     20 
     21 #ifndef TST_COMMON_H__
     22 #define TST_COMMON_H__
     23 
     24 #define LTP_ATTRIBUTE_NORETURN		__attribute__((noreturn))
     25 #define LTP_ATTRIBUTE_UNUSED		__attribute__((unused))
     26 #define LTP_ATTRIBUTE_UNUSED_RESULT	__attribute__((warn_unused_result))
     27 
     28 #ifndef ARRAY_SIZE
     29 # define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
     30 #endif
     31 
     32 /* Round x to the next multiple of a.
     33  * a should be a power of 2.
     34  */
     35 #define LTP_ALIGN(x, a)    __LTP_ALIGN_MASK(x, (typeof(x))(a) - 1)
     36 #define __LTP_ALIGN_MASK(x, mask)  (((x) + (mask)) & ~(mask))
     37 
     38 #endif /* TST_COMMON_H__ */
     39