Skip to content

Commit

Permalink
[libcrystax] Fix 'alloca' definition (bug #1170)
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Moskalchuk <dm@crystax.net>
  • Loading branch information
dmsck committed Dec 3, 2015
1 parent a77354a commit 43c0552
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
40 changes: 40 additions & 0 deletions sources/crystax/include/alloca.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2011-2015 CrystaX .NET.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY CrystaX .NET ''AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CrystaX .NET OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of CrystaX .NET.
*/

#ifndef __CRYSTAX_ALLOCA_H_54030085552640179942B7123EA7CEDC
#define __CRYSTAX_ALLOCA_H_54030085552640179942B7123EA7CEDC

#include <crystax/id.h>

#ifdef alloca
#undef alloca
#define alloca(sz) __builtin_alloca(sz)
#endif

#endif /* __CRYSTAX_ALLOCA_H_54030085552640179942B7123EA7CEDC */
7 changes: 7 additions & 0 deletions tests/build/crystax-issue1170-alloca-redefined/jni/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := test-alloca
LOCAL_SRC_FILES := main.c
LOCAL_CFLAGS := -Wall -Wextra -Werror
include $(BUILD_EXECUTABLE)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APP_ABI := all
7 changes: 7 additions & 0 deletions tests/build/crystax-issue1170-alloca-redefined/jni/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <stdlib.h>
#include <alloca.h>

int main()
{
return 0;
}

0 comments on commit 43c0552

Please sign in to comment.