1 /* 2 * Copyright (c) 2017 Ngie Cooper <ngie@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 15 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 16 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27 #include <sys/cdefs.h> 28 __RCSID("$FreeBSD$"); 29 30 #include <assert.h> 31 #include <stdbool.h> 32 #include <stdlib.h> 33 #include <stdio.h> 34 35 int 36 main(void) 37 { 38 bool known_arch_type; 39 40 known_arch_type = false; 41 #ifdef __LP64__ 42 printf("LP64\n"); 43 known_arch_type = true; 44 #endif 45 #ifdef __LP32__ 46 printf("LP32\n"); 47 known_arch_type = true; 48 #endif 49 #ifdef __ILP32__ 50 printf("ILP32\n"); 51 known_arch_type = true; 52 #endif 53 54 if (known_arch_type) 55 exit(0); 56 57 fprintf(stderr, "unknown architecture type detected\n"); 58 assert(0); 59 } 60