compiler.hh revision 11168:f98eb2da15a4
12348SN/A/*
22348SN/A * Copyright (c) 2012 ARM Limited
32348SN/A * All rights reserved
42348SN/A *
52348SN/A * The license below extends only to copyright in the software and shall
62348SN/A * not be construed as granting a license to any other intellectual
72348SN/A * property including but not limited to intellectual property relating
82348SN/A * to a hardware implementation of the functionality of the software
92348SN/A * licensed hereunder.  You may use the software subject to the license
102348SN/A * terms below provided that you ensure that this notice is replicated
112348SN/A * unmodified and in its entirety in all distributions of the software,
122348SN/A * modified or unmodified, in source code or in binary form.
132348SN/A *
142348SN/A * Copyright (c) 2006 The Regents of The University of Michigan
152348SN/A * All rights reserved.
162348SN/A *
172348SN/A * Redistribution and use in source and binary forms, with or without
182348SN/A * modification, are permitted provided that the following conditions are
192348SN/A * met: redistributions of source code must retain the above copyright
202348SN/A * notice, this list of conditions and the following disclaimer;
212348SN/A * redistributions in binary form must reproduce the above copyright
222348SN/A * notice, this list of conditions and the following disclaimer in the
232348SN/A * documentation and/or other materials provided with the distribution;
242348SN/A * neither the name of the copyright holders nor the names of its
252348SN/A * contributors may be used to endorse or promote products derived from
262348SN/A * this software without specific prior written permission.
272689Sktlim@umich.edu *
282689Sktlim@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
292348SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
302325SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
315804Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
323918Ssaidi@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
332325SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
342325SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
352325SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
365804Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
375804Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
385804Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
395804Snate@binkert.org *
405804Snate@binkert.org * Authors: Ali Saidi
415804Snate@binkert.org */
425804Snate@binkert.org
432325SN/A#ifndef __BASE_COMPILER_HH__
442325SN/A#define __BASE_COMPILER_HH__
453918Ssaidi@eecs.umich.edu
462325SN/A// http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
472325SN/A
482325SN/A#if defined(__GNUC__) // clang or gcc
492325SN/A#  define M5_ATTR_NORETURN  __attribute__((noreturn))
502325SN/A#  define M5_DUMMY_RETURN
512348SN/A#  define M5_VAR_USED __attribute__((unused))
522348SN/A#  define M5_ATTR_PACKED __attribute__ ((__packed__))
532325SN/A#  define M5_NO_INLINE __attribute__ ((__noinline__))
542325SN/A#  define M5_DEPRECATED __attribute__((deprecated))
552325SN/A#  define M5_DEPRECATED_MSG(MSG) __attribute__((deprecated(MSG)))
562325SN/A#endif
572325SN/A
582325SN/A#if defined(__clang__)
592325SN/A#  define M5_CLASS_VAR_USED M5_VAR_USED
602325SN/A#else
612325SN/A#  define M5_CLASS_VAR_USED
622325SN/A#endif
632325SN/A
642325SN/A#endif // __BASE_COMPILER_HH__
652325SN/A