11aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania/*
21aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * Copyright (C) 2009 The Android Open Source Project
31aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * All rights reserved.
41aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania *
51aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * Redistribution and use in source and binary forms, with or without
61aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * modification, are permitted provided that the following conditions
71aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * are met:
81aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania *  * Redistributions of source code must retain the above copyright
91aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania *    notice, this list of conditions and the following disclaimer.
101aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania *  * Redistributions in binary form must reproduce the above copyright
111aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania *    notice, this list of conditions and the following disclaimer in
121aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania *    the documentation and/or other materials provided with the
131aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania *    distribution.
141aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania *
151aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
161aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
171aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
181aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
191aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
201aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
211aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
221aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
231aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
241aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
251aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
261aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania * SUCH DAMAGE.
271aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania */
281aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania
291aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania#include <csignal>
30b381ead492251a797d2df4b260cb01eb1f64cfadDavid 'Digit' Turner#if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CSIGNAL__
311aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania#error "Wrong header file included!!"
321aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania#endif
331aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania
341aa5708e437b96e04f31d9c9f167427411ba5510Niko Catanianamespace {
351aa5708e437b96e04f31d9c9f167427411ba5510Niko Cataniaconst int kPassed = 0;
361aa5708e437b96e04f31d9c9f167427411ba5510Niko Cataniaconst int kFailed = 1;
371aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania#define FAIL_UNLESS(f) if (!android::f()) return kFailed;
381aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania}  // anonymous namespace
391aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania
401aa5708e437b96e04f31d9c9f167427411ba5510Niko Catanianamespace android
411aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania{
421aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania#ifdef raise
431aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania#error "raise must not be a macro"
441aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania#endif
451aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania
461aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania#ifndef SIGABRT
471aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania#error "SIGABRT must be a macro"
481aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania#endif
491aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania
501aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania#ifndef SIGILL
511aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania#error "SIGILL must be a macro"
521aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania#endif
531aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania
541aa5708e437b96e04f31d9c9f167427411ba5510Niko Cataniausing std::raise;
551aa5708e437b96e04f31d9c9f167427411ba5510Niko Cataniausing std::signal;
561aa5708e437b96e04f31d9c9f167427411ba5510Niko Cataniabool testSigAtomicT()
571aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania{
581aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania    volatile std::sig_atomic_t s;
591aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania    return true;
601aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania}
611aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania
621aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania}  // namespace android
631aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania
641aa5708e437b96e04f31d9c9f167427411ba5510Niko Cataniaint main(int argc, char **argv)
651aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania{
661aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania    FAIL_UNLESS(testSigAtomicT);
671aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania    return kPassed;
681aa5708e437b96e04f31d9c9f167427411ba5510Niko Catania}
69