From owner-svn-src-vendor@FreeBSD.ORG Tue Mar 20 17:41:02 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9E001065677; Tue, 20 Mar 2012 17:41:02 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D4C6C8FC18; Tue, 20 Mar 2012 17:41:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KHf28w030145; Tue, 20 Mar 2012 17:41:02 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KHf2XI030141; Tue, 20 Mar 2012 17:41:02 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201203201741.q2KHf2XI030141@svn.freebsd.org> From: David Chisnall Date: Tue, 20 Mar 2012 17:41:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233233 - vendor/libcxxrt/dist X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 17:41:03 -0000 Author: theraven Date: Tue Mar 20 17:41:02 2012 New Revision: 233233 URL: http://svn.freebsd.org/changeset/base/233233 Log: Import new version of libcxxrt to vendor branch. Approved by: dim (mentor) Deleted: vendor/libcxxrt/dist/typeinfo Modified: vendor/libcxxrt/dist/dynamic_cast.cc vendor/libcxxrt/dist/exception.cc vendor/libcxxrt/dist/typeinfo.h Modified: vendor/libcxxrt/dist/dynamic_cast.cc ============================================================================== --- vendor/libcxxrt/dist/dynamic_cast.cc Tue Mar 20 16:56:35 2012 (r233232) +++ vendor/libcxxrt/dist/dynamic_cast.cc Tue Mar 20 17:41:02 2012 (r233233) @@ -46,9 +46,65 @@ struct vtable_header */ #define ADD_TO_PTR(x, off) (__typeof__(x))(((char*)x) + off) -bool __class_type_info::can_cast_to(const struct __class_type_info *other) const +bool std::type_info::__do_catch(std::type_info const *ex_type, + void **exception_object, + unsigned int outer) const { - return this == other; + const type_info *type = this; + + if (type == ex_type) + { + return true; + } + if (const __class_type_info *cti = dynamic_cast(type)) + { + return ex_type->__do_upcast(cti, exception_object); + } + return false; +} + +bool __pbase_type_info::__do_catch(std::type_info const *ex_type, + void **exception_object, + unsigned int outer) const +{ + if (ex_type == this) + { + return true; + } + if (!ex_type->__is_pointer_p()) + { + // Can't catch a non-pointer type in a pointer catch + return false; + } + + if (!(outer & 1)) + { + // If the low bit is cleared on this means that we've gone + // through a pointer that is not const qualified. + return false; + } + // Clear the low bit on outer if we're not const qualified. + if (!(__flags & __const_mask)) + { + outer &= ~1; + } + + const __pbase_type_info *ptr_type = + static_cast(ex_type); + + if (ptr_type->__flags & ~__flags) + { + // Handler pointer is less qualified + return false; + } + + // Special case for void* handler. + if(*__pointee == typeid(void)) + { + return true; + } + + return __pointee->__do_catch(ptr_type->__pointee, exception_object, outer); } void *__class_type_info::cast_to(void *obj, const struct __class_type_info *other) const @@ -60,12 +116,6 @@ void *__class_type_info::cast_to(void *o return 0; } - -bool __si_class_type_info::can_cast_to(const struct __class_type_info *other) const -{ - return this == other || __base_type->can_cast_to(other); -} - void *__si_class_type_info::cast_to(void *obj, const struct __class_type_info *other) const { if (this == other) @@ -74,31 +124,32 @@ void *__si_class_type_info::cast_to(void } return __base_type->cast_to(obj, other); } - - -bool __vmi_class_type_info::can_cast_to(const struct __class_type_info *other) const +bool __si_class_type_info::__do_upcast(const __class_type_info *target, + void **thrown_object) const { - if (this == other) + if (this == target) { return true; } - for (unsigned int i=0 ; i<__base_count ; i++) - { - const __base_class_type_info *info = &__base_info[i]; - if(info->isPublic() && info->__base_type->can_cast_to(other)) - { - return true; - } - } - return false; + return __base_type->__do_upcast(target, thrown_object); } void *__vmi_class_type_info::cast_to(void *obj, const struct __class_type_info *other) const { - if (this == other) + if (__do_upcast(other, &obj)) { return obj; } + return 0; +} + +bool __vmi_class_type_info::__do_upcast(const __class_type_info *target, + void **thrown_object) const +{ + if (this == target) + { + return true; + } for (unsigned int i=0 ; i<__base_count ; i++) { const __base_class_type_info *info = &__base_info[i]; @@ -111,6 +162,7 @@ void *__vmi_class_type_info::cast_to(voi // virtual table of the virtual base offset for the virtual base // referenced (negative).' + void *obj = *thrown_object; if (info->isVirtual()) { // Object's vtable @@ -121,18 +173,17 @@ void *__vmi_class_type_info::cast_to(voi } void *cast = ADD_TO_PTR(obj, offset); - if (info->__base_type == other) + if (info->__base_type == target || + (info->__base_type->__do_upcast(target, &cast))) { - return cast; - } - if ((cast = info->__base_type->cast_to(cast, other))) - { - return cast; + *thrown_object = cast; + return true; } } return 0; } + /** * ABI function used to implement the dynamic_cast<> operator. Some cases of * this operator are implemented entirely in the compiler (e.g. to void*). Modified: vendor/libcxxrt/dist/exception.cc ============================================================================== --- vendor/libcxxrt/dist/exception.cc Tue Mar 20 16:56:35 2012 (r233232) +++ vendor/libcxxrt/dist/exception.cc Tue Mar 20 17:41:02 2012 (r233233) @@ -847,14 +847,11 @@ static bool check_type_signature(__cxa_e const std::type_info *type, void *&adjustedPtr) { - // TODO: For compatibility with the GNU implementation, we should move this - // out into a __do_catch() virtual function in std::type_info void *exception_ptr = (void*)(ex+1); - const std::type_info *ex_type = ex->exceptionType; + const std::type_info *ex_type = ex->exceptionType; - const __pointer_type_info *ptr_type = - dynamic_cast(ex_type); - if (0 != ptr_type) + bool is_ptr = ex_type->__is_pointer_p(); + if (is_ptr) { exception_ptr = *(void**)exception_ptr; } @@ -862,11 +859,6 @@ static bool check_type_signature(__cxa_e // // Note: A 0 here is a catchall, not a cleanup, so we return true to // indicate that we found a catch. - // - // TODO: Provide a class for matching against foreign exceptions. This is - // already done in libobjc2, allowing C++ exceptions to be boxed as - // Objective-C objects. We should do something similar, allowing foreign - // exceptions to be wrapped in a C++ exception and delivered. if (0 == type) { if (ex) @@ -878,28 +870,6 @@ static bool check_type_signature(__cxa_e if (0 == ex) { return false; } - const __pointer_type_info *target_ptr_type = - dynamic_cast(type); - - if (0 != ptr_type && 0 != target_ptr_type) - { - if (ptr_type->__flags & ~target_ptr_type->__flags) - { - // Handler pointer is less qualified - return false; - } - - // Special case for void* handler. - if(*target_ptr_type->__pointee == typeid(void)) - { - adjustedPtr = exception_ptr; - return true; - } - - ex_type = ptr_type->__pointee; - type = target_ptr_type->__pointee; - } - // If the types are the same, no casting is needed. if (*type == *ex_type) { @@ -907,18 +877,13 @@ static bool check_type_signature(__cxa_e return true; } - const __class_type_info *cls_type = - dynamic_cast(ex_type); - const __class_type_info *target_cls_type = - dynamic_cast(type); - - if (0 != cls_type && - 0 != target_cls_type && - cls_type->can_cast_to(target_cls_type)) + + if (type->__do_catch(ex_type, &exception_ptr, 1)) { - adjustedPtr = cls_type->cast_to(exception_ptr, target_cls_type); + adjustedPtr = exception_ptr; return true; } + return false; } /** Modified: vendor/libcxxrt/dist/typeinfo.h ============================================================================== --- vendor/libcxxrt/dist/typeinfo.h Tue Mar 20 16:56:35 2012 (r233232) +++ vendor/libcxxrt/dist/typeinfo.h Tue Mar 20 17:41:02 2012 (r233233) @@ -26,7 +26,86 @@ #include #include "abi_namespace.h" -#include "typeinfo" + +namespace ABI_NAMESPACE +{ + struct __class_type_info; +} +namespace std +{ + /** + * Standard type info class. The layout of this class is specified by the + * ABI. The layout of the vtable is not, but is intended to be + * compatible with the GNU ABI. + * + * Unlike the GNU version, the vtable layout is considered semi-private. + */ + class type_info + { + public: + /** + * Virtual destructor. This class must have one virtual function to + * ensure that it has a vtable. + */ + virtual ~type_info(); + bool operator==(const type_info &) const; + bool operator!=(const type_info &) const; + bool before(const type_info &) const; + const char* name() const; + type_info(); + private: + type_info(const type_info& rhs); + type_info& operator= (const type_info& rhs); + const char *__type_name; + /* + * The following functions are in this order to match the + * vtable layout of libsupc++. This allows libcxxrt to be used + * with libraries that depend on this. + * + * These functions are in the public headers for libstdc++, so + * we have to assume that someone will probably call them and + * expect them to work. Their names must also match the names used in + * libsupc++, so that code linking against this library can subclass + * type_info and correctly fill in the values in the vtables. + */ + public: + /** + * Catch function. Allows external libraries to implement + * their own basic types. This is used, for example, in the + * GNUstep Objective-C runtime to allow Objective-C types to be + * caught in G++ catch blocks. + * + * The outer parameter indicates the number of outer pointers + * in the high bits. The low bit indicates whether the + * pointers are const qualified. + */ + virtual bool __do_catch(const type_info *thrown_type, + void **thrown_object, + unsigned outer) const; + /** + * Performs an upcast. This is used in exception handling to + * cast from subclasses to superclasses. If the upcast is + * possible, it returns true and adjusts the pointer. If the + * upcast is not possible, it returns false and does not adjust + * the pointer. + */ + virtual bool __do_upcast( + const ABI_NAMESPACE::__class_type_info *target, + void **thrown_object) const + { + return false; + } + /** + * Returns true if this is some pointer type, false otherwise. + */ + virtual bool __is_pointer_p() const { return false; } + /** + * Returns true if this is some function type, false otherwise. + */ + virtual bool __is_function_p() const { return false; } + }; +} + namespace ABI_NAMESPACE { @@ -50,6 +129,7 @@ namespace ABI_NAMESPACE struct __function_type_info : public std::type_info { virtual ~__function_type_info(); + virtual bool __is_function_p() const { return true; } }; /** * Type info for enums. @@ -68,13 +148,12 @@ namespace ABI_NAMESPACE /** * Function implementing dynamic casts. */ - virtual void *cast_to(void *obj, - const struct __class_type_info *other) const; - /** - * Function returning whether a cast from this type to another type is - * possible. - */ - virtual bool can_cast_to(const struct __class_type_info *other) const; + virtual void *cast_to(void *obj, const struct __class_type_info *other) const; + virtual bool __do_upcast(const __class_type_info *target, + void **thrown_object) const + { + return this == target; + } }; /** @@ -85,8 +164,10 @@ namespace ABI_NAMESPACE { virtual ~__si_class_type_info(); const __class_type_info *__base_type; + virtual bool __do_upcast( + const ABI_NAMESPACE::__class_type_info *target, + void **thrown_object) const; virtual void *cast_to(void *obj, const struct __class_type_info *other) const; - virtual bool can_cast_to(const struct __class_type_info *other) const; }; /** @@ -166,8 +247,10 @@ namespace ABI_NAMESPACE /** The class is diamond shaped. */ __diamond_shaped_mask = 0x2 }; + virtual bool __do_upcast( + const ABI_NAMESPACE::__class_type_info *target, + void **thrown_object) const; virtual void *cast_to(void *obj, const struct __class_type_info *other) const; - virtual bool can_cast_to(const struct __class_type_info *other) const; }; /** @@ -201,6 +284,10 @@ namespace ABI_NAMESPACE /** Pointer is a pointer to a member of an incomplete class. */ __incomplete_class_mask = 0x10 }; + virtual bool __is_pointer_p() const { return true; } + virtual bool __do_catch(const type_info *thrown_type, + void **thrown_object, + unsigned outer) const; }; /** From owner-svn-src-vendor@FreeBSD.ORG Tue Mar 20 17:43:31 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07651106566B; Tue, 20 Mar 2012 17:43:31 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCF9F8FC19; Tue, 20 Mar 2012 17:43:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KHhUGe030259; Tue, 20 Mar 2012 17:43:30 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KHhUQO030258; Tue, 20 Mar 2012 17:43:30 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201203201743.q2KHhUQO030258@svn.freebsd.org> From: David Chisnall Date: Tue, 20 Mar 2012 17:43:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233234 - vendor/libcxxrt/2012-03-20-cddcf8734ed06ada9384a461bc21d58b44f6eba1 X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 17:43:31 -0000 Author: theraven Date: Tue Mar 20 17:43:30 2012 New Revision: 233234 URL: http://svn.freebsd.org/changeset/base/233234 Log: Tag new version of libcxxrt in vendor branch. Approved by: dim (mentor) Added: vendor/libcxxrt/2012-03-20-cddcf8734ed06ada9384a461bc21d58b44f6eba1/ - copied from r233233, vendor/libcxxrt/dist/ From owner-svn-src-vendor@FreeBSD.ORG Tue Mar 20 18:17:34 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0485106566B; Tue, 20 Mar 2012 18:17:34 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96B3C8FC08; Tue, 20 Mar 2012 18:17:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KIHY0F031584; Tue, 20 Mar 2012 18:17:34 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KIHYQS031570; Tue, 20 Mar 2012 18:17:34 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201203201817.q2KIHYQS031570@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 20 Mar 2012 18:17:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233237 - in vendor-sys/acpica/dist: . generate/unix/iasl source/common source/compiler source/components/debugger source/components/hardware source/components/namespace source/componen... X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 18:17:34 -0000 Author: jkim Date: Tue Mar 20 18:17:33 2012 New Revision: 233237 URL: http://svn.freebsd.org/changeset/base/233237 Log: Import ACPICA 20120320. Added: vendor-sys/acpica/dist/source/compiler/preprocess.h (contents, props changed) vendor-sys/acpica/dist/source/compiler/prexpress.c (contents, props changed) vendor-sys/acpica/dist/source/compiler/prmacros.c (contents, props changed) vendor-sys/acpica/dist/source/compiler/prparser.l vendor-sys/acpica/dist/source/compiler/prparser.y vendor-sys/acpica/dist/source/compiler/prscan.c (contents, props changed) vendor-sys/acpica/dist/source/compiler/prutils.c (contents, props changed) Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/generate/unix/iasl/Makefile vendor-sys/acpica/dist/source/common/adisasm.c vendor-sys/acpica/dist/source/common/getopt.c vendor-sys/acpica/dist/source/compiler/Makefile vendor-sys/acpica/dist/source/compiler/aslcodegen.c vendor-sys/acpica/dist/source/compiler/aslcompile.c vendor-sys/acpica/dist/source/compiler/aslcompiler.h vendor-sys/acpica/dist/source/compiler/aslcompiler.y vendor-sys/acpica/dist/source/compiler/aslerror.c vendor-sys/acpica/dist/source/compiler/aslfiles.c vendor-sys/acpica/dist/source/compiler/aslglobal.h vendor-sys/acpica/dist/source/compiler/aslmain.c vendor-sys/acpica/dist/source/compiler/aslmessages.h vendor-sys/acpica/dist/source/compiler/aslstartup.c vendor-sys/acpica/dist/source/compiler/asltypes.h vendor-sys/acpica/dist/source/compiler/aslutils.c vendor-sys/acpica/dist/source/compiler/dtcompile.c vendor-sys/acpica/dist/source/compiler/dtcompiler.h vendor-sys/acpica/dist/source/compiler/dtexpress.c vendor-sys/acpica/dist/source/compiler/dtio.c vendor-sys/acpica/dist/source/compiler/dtparser.y vendor-sys/acpica/dist/source/compiler/readme.txt vendor-sys/acpica/dist/source/components/debugger/dbcmds.c vendor-sys/acpica/dist/source/components/hardware/hwesleep.c vendor-sys/acpica/dist/source/components/hardware/hwsleep.c vendor-sys/acpica/dist/source/components/hardware/hwxfsleep.c vendor-sys/acpica/dist/source/components/namespace/nsdump.c vendor-sys/acpica/dist/source/components/namespace/nsdumpdv.c vendor-sys/acpica/dist/source/components/namespace/nspredef.c vendor-sys/acpica/dist/source/components/namespace/nsrepair.c vendor-sys/acpica/dist/source/components/namespace/nsutils.c vendor-sys/acpica/dist/source/components/tables/tbfadt.c vendor-sys/acpica/dist/source/components/tables/tbinstal.c vendor-sys/acpica/dist/source/components/tables/tbutils.c vendor-sys/acpica/dist/source/include/achware.h vendor-sys/acpica/dist/source/include/aclocal.h vendor-sys/acpica/dist/source/include/acnames.h vendor-sys/acpica/dist/source/include/acnamesp.h vendor-sys/acpica/dist/source/include/acoutput.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/actypes.h vendor-sys/acpica/dist/source/tools/acpisrc/astable.c Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/changes.txt Tue Mar 20 18:17:33 2012 (r233237) @@ -1,4 +1,96 @@ ---------------------------------------- +20 March 2012. Summary of changes for version 20120320: + +This release is available at www.acpica.org/downloads. +The ACPI 5.0 specification is available at www.acpi.info. + +1) ACPICA Core Subsystem: + +Enhanced the sleep/wake interfaces to optionally execute the _GTS method +(Going To Sleep) and the _BFS method (Back From Sleep). Windows apparently +does not execute these methods, and therefore these methods are often +untested. It has been seen on some systems where the execution of these +methods causes errors and also prevents the machine from entering S5. It is +therefore suggested that host operating systems do not execute these methods +by default. In the future, perhaps these methods can be optionally executed +based on the age of the system and/or what is the newest version of Windows +that the BIOS asks for via _OSI. Changed interfaces: AcpiEnterSleepState and +AcpileaveSleepStatePrep. See the ACPICA reference and Linux BZ 13041. Lin +Ming. + +Fixed a problem where the length of the local/common FADT was set too early. +The local FADT table length cannot be set to the common length until the +original length has been examined. There is code that checks the table length +and sets various fields appropriately. This can affect older machines with +early FADT versions. For example, this can cause inadvertent writes to the +CST_CNT register. Julian Anastasov. + +Fixed a mapping issue related to a physical table override. Use the deferred +mapping mechanism for tables loaded via the physical override OSL interface. +This allows for early mapping before the virtual memory manager is available. +Thomas Renninger, Bob Moore. + +Enhanced the automatic return-object repair code: Repair a common problem with +predefined methods that are defined to return a variable-length Package of +sub-objects. If there is only one sub-object, some BIOS ASL code mistakenly +simply returns the single object instead of a Package with one sub-object. +This new support will repair this error by wrapping a Package object around +the original object, creating the correct and expected Package with one sub- +object. Names that can be repaired in this manner include: _ALR, _CSD, _HPX, +_MLS, _PLD, _PRT, _PSS, _TRT, _TSS, _BCL, _DOD, _FIX, and _Sx. ACPICA BZ 939. + +Changed the exception code returned for invalid ACPI paths passed as +parameters to external interfaces such as AcpiEvaluateObject. Was +AE_BAD_PARAMETER, now is the more sensible AE_BAD_PATHNAME. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The debug +version of the code includes the debug output trace mechanism and has a much +larger code and data size. + + Previous Release: + Non-Debug Version: 93.0K Code, 25.0K Data, 118.0K Total + Debug Version: 172.5K Code, 73.2K Data, 245.7K Total + Current Release: + Non-Debug Version: 92.9K Code, 25.0K Data, 117.9K Total + Debug Version: 172.5K Code, 73.2K Data, 245.7K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Added the infrastructure and initial implementation of a integrated C- +like preprocessor. This will simplify BIOS development process by eliminating +the need for a separate preprocessing step during builds. On Windows, it also +eliminates the need to install a separate C compiler. ACPICA BZ 761. Some +features including full #define() macro support are still under development. +These preprocessor directives are supported: + #define + #elif + #else + #endif + #error + #if + #ifdef + #ifndef + #include + #pragma message + #undef + #warning +In addition, these new command line options are supported: + -D Define symbol for preprocessor use + -li Create preprocessed output file (*.i) + -P Preprocess only and create preprocessor output file (*.i) + +Table Compiler: Fixed a problem where the equals operator within an expression +did not work properly. + +Updated iASL to use the current versions of Bison/Flex. Updated the Windows +project file to invoke these tools from the standard location. ACPICA BZ 904. +Versions supported: + Flex for Windows: V2.5.4 + Bison for Windows: V2.4.1 + +---------------------------------------- 15 February 2012. Summary of changes for version 20120215: This release is available at www.acpica.org/downloads. Modified: vendor-sys/acpica/dist/generate/unix/iasl/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/iasl/Makefile Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/generate/unix/iasl/Makefile Tue Mar 20 18:17:33 2012 (r233237) @@ -32,13 +32,16 @@ vpath %.c \ HEADERS = \ $(wildcard $(ASL_COMPILER)/*.h) \ $(OBJDIR)/aslcompiler.y.h \ - $(OBJDIR)/dtparser.y.h + $(OBJDIR)/dtparser.y.h \ + $(OBJDIR)/prparser.y.h OBJECTS = \ $(OBJDIR)/aslcompilerlex.o \ $(OBJDIR)/aslcompilerparse.o \ $(OBJDIR)/dtparserlex.o \ $(OBJDIR)/dtparserparse.o \ + $(OBJDIR)/prparserlex.o \ + $(OBJDIR)/prparserparse.o \ $(OBJDIR)/adfile.o \ $(OBJDIR)/adisasm.o \ $(OBJDIR)/adwalk.o \ @@ -142,6 +145,10 @@ OBJECTS = \ $(OBJDIR)/nswalk.o \ $(OBJDIR)/nsxfobj.o \ $(OBJDIR)/osunixxf.o \ + $(OBJDIR)/prexpress.o \ + $(OBJDIR)/prmacros.o \ + $(OBJDIR)/prscan.o \ + $(OBJDIR)/prutils.o \ $(OBJDIR)/psargs.o \ $(OBJDIR)/psloop.o \ $(OBJDIR)/psopcode.o \ @@ -177,7 +184,9 @@ INTERMEDIATES = \ $(OBJDIR)/aslcompilerlex.c \ $(OBJDIR)/aslcompilerparse.c \ $(OBJDIR)/dtparserlex.c \ - $(OBJDIR)/dtparserparse.c + $(OBJDIR)/dtparserparse.c \ + $(OBJDIR)/prparserlex.c \ + $(OBJDIR)/prparserparse.c MISC = \ $(OBJDIR)/aslcompilerparse.h \ @@ -185,7 +194,10 @@ MISC = \ $(OBJDIR)/aslcompilerparse.output \ $(OBJDIR)/dtparserparse.h \ $(OBJDIR)/dtparser.y.h \ - $(OBJDIR)/dtparserparse.output + $(OBJDIR)/dtparserparse.output \ + $(OBJDIR)/prparserparse.h \ + $(OBJDIR)/prparser.y.h \ + $(OBJDIR)/prparserparse.output # # Flags specific to iASL compiler @@ -217,15 +229,26 @@ $(OBJDIR)/dtparserlex.c : $(ASL_COM $(OBJDIR)/dtparserparse.c $(OBJDIR)/dtparserparse.h : $(ASL_COMPILER)/dtparser.y ${YACC} ${YFLAGS} -pDtParser -o$@ $? +$(OBJDIR)/prparserlex.c : $(ASL_COMPILER)/prparser.l + ${LEX} ${LFLAGS} -PPrParser -o$@ $? + +$(OBJDIR)/prparserparse.c $(OBJDIR)/prparserparse.h : $(ASL_COMPILER)/prparser.y + ${YACC} ${YFLAGS} -pPrParser -o$@ $? + + # Rename headers produced by bison/yacc +$(OBJDIR)/aslcompiler.y.h : $(OBJDIR)/aslcompilerparse.h + @echo Copy intermediate file: + @cp -f -v $(OBJDIR)/aslcompilerparse.h $(OBJDIR)/aslcompiler.y.h + $(OBJDIR)/dtparser.y.h: $(OBJDIR)/dtparserparse.h @echo Copy intermediate file: @cp -f -v $(OBJDIR)/dtparserparse.h $(OBJDIR)/dtparser.y.h -$(OBJDIR)/aslcompiler.y.h : $(OBJDIR)/aslcompilerparse.h +$(OBJDIR)/prparser.y.h: $(OBJDIR)/prparserparse.h @echo Copy intermediate file: - @cp -f -v $(OBJDIR)/aslcompilerparse.h $(OBJDIR)/aslcompiler.y.h + @cp -f -v $(OBJDIR)/prparserparse.h $(OBJDIR)/prparser.y.h # @@ -246,6 +269,12 @@ $(OBJDIR)/dtparserlex.o : $(OBJDIR) $(OBJDIR)/dtparserparse.o : $(OBJDIR)/dtparserparse.c $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $? +$(OBJDIR)/prparserlex.o : $(OBJDIR)/prparserlex.c + $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $? + +$(OBJDIR)/prparserparse.o : $(OBJDIR)/prparserparse.c + $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $? + $(OBJDIR)/%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) Modified: vendor-sys/acpica/dist/source/common/adisasm.c ============================================================================== --- vendor-sys/acpica/dist/source/common/adisasm.c Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/common/adisasm.c Tue Mar 20 18:17:33 2012 (r233237) @@ -75,6 +75,10 @@ LsSetupNsList ( /* Local prototypes */ +static UINT32 +AdGetFileSize ( + FILE *File); + static void AdCreateTableHeader ( char *Filename, @@ -160,6 +164,38 @@ static ACPI_PARSE_OBJECT *AcpiGbl_Par /******************************************************************************* * + * FUNCTION: AdGetFileSize + * + * PARAMETERS: File - Open file handle + * + * RETURN: File Size + * + * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open. + * + ******************************************************************************/ + +static UINT32 +AdGetFileSize ( + FILE *File) +{ + UINT32 FileSize; + long Offset; + + + Offset = ftell (File); + + fseek (File, 0, SEEK_END); + FileSize = (UINT32) ftell (File); + + /* Restore file pointer */ + + fseek (File, Offset, SEEK_SET); + return (FileSize); +} + + +/******************************************************************************* + * * FUNCTION: AdInitialize * * PARAMETERS: None @@ -380,8 +416,10 @@ AdAmlDisassemble ( "FieldName : FieldValue\n */\n\n"); AcpiDmDumpDataTable (Table); - fprintf (stderr, "Acpi Data Table [%4.4s] decoded, written to \"%s\"\n", - Table->Signature, DisasmFilename); + fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n", + Table->Signature); + fprintf (stderr, "Formatted output: %s - %u bytes\n", + DisasmFilename, AdGetFileSize (File)); } else { @@ -490,9 +528,9 @@ AdAmlDisassemble ( if (AcpiGbl_DbOpt_disasm) { AdDisplayTables (Filename, Table); - fprintf (stderr, - "Disassembly completed, written to \"%s\"\n", - DisasmFilename); + fprintf (stderr, "Disassembly completed\n"); + fprintf (stderr, "ASL Output: %s - %u bytes\n", + DisasmFilename, AdGetFileSize (File)); } } Modified: vendor-sys/acpica/dist/source/common/getopt.c ============================================================================== --- vendor-sys/acpica/dist/source/common/getopt.c Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/common/getopt.c Tue Mar 20 18:17:33 2012 (r233237) @@ -49,7 +49,8 @@ #include "accommon.h" #include "acapps.h" -#define ERR(szz,czz) if(AcpiGbl_Opterr){fprintf(stderr,"%s%s%c\n",argv[0],szz,czz);} +#define ACPI_OPTION_ERROR(msg, badchar) \ + if (AcpiGbl_Opterr) {fprintf (stderr, "%s%c\n", msg, badchar);} int AcpiGbl_Opterr = 1; @@ -87,12 +88,12 @@ AcpiGetopt( argv[AcpiGbl_Optind][0] != '-' || argv[AcpiGbl_Optind][1] == '\0') { - return(EOF); + return (EOF); } else if (strcmp (argv[AcpiGbl_Optind], "--") == 0) { AcpiGbl_Optind++; - return(EOF); + return (EOF); } } @@ -105,7 +106,7 @@ AcpiGetopt( if (CurrentChar == ':' || (OptsPtr = strchr (opts, CurrentChar)) == NULL) { - ERR (": illegal option -- ", CurrentChar); + ACPI_OPTION_ERROR ("Illegal option: -", CurrentChar); if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0') { @@ -126,7 +127,7 @@ AcpiGetopt( } else if (++AcpiGbl_Optind >= argc) { - ERR (": option requires an argument -- ", CurrentChar); + ACPI_OPTION_ERROR ("Option requires an argument: -", CurrentChar); CurrentCharPtr = 1; return ('?'); @@ -156,6 +157,26 @@ AcpiGetopt( CurrentCharPtr = 1; } + /* Option has a required single-char argument? */ + + else if (*OptsPtr == '|') + { + if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0') + { + AcpiGbl_Optarg = &argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)]; + } + else + { + ACPI_OPTION_ERROR ("Option requires a single-character suboption: -", CurrentChar); + + CurrentCharPtr = 1; + return ('?'); + } + + AcpiGbl_Optind++; + CurrentCharPtr = 1; + } + /* Option with no arguments */ else Modified: vendor-sys/acpica/dist/source/compiler/Makefile ============================================================================== --- vendor-sys/acpica/dist/source/compiler/Makefile Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/Makefile Tue Mar 20 18:17:33 2012 (r233237) @@ -64,13 +64,16 @@ vpath %.c \ HEADERS = \ $(wildcard $(ASL_COMPILER)/*.h) \ aslcompiler.y.h \ - dtparser.y.h + dtparser.y.h \ + prparser.y.h OBJECTS = \ aslcompilerlex.o \ aslcompilerparse.o \ dtparserlex.o \ dtparserparse.o \ + prparserlex.o \ + prparserparse.o \ adfile.o \ adisasm.o \ adwalk.o \ @@ -174,6 +177,10 @@ OBJECTS = \ nswalk.o \ nsxfobj.o \ osunixxf.o \ + prexpress.o \ + prmacros.o \ + prscan.o \ + prutils.o \ psargs.o \ psloop.o \ psopcode.o \ @@ -209,7 +216,9 @@ INTERMEDIATES = \ aslcompilerlex.c \ aslcompilerparse.c \ dtparserlex.c \ - dtparserparse.c + dtparserparse.c \ + prparserlex.c \ + prparserparse.c MISC = \ aslcompilerparse.h \ @@ -217,7 +226,10 @@ MISC = \ aslcompilerparse.output \ dtparserparse.h \ dtparser.y.h \ - dtparserparse.output + dtparserparse.output \ + prparserparse.h \ + prparser.y.h \ + prparserparse.output CFLAGS+= \ -D$(HOST) \ @@ -289,15 +301,26 @@ dtparserlex.c : $(ASL_COMPILER)/dtp dtparserparse.c dtparserparse.h : $(ASL_COMPILER)/dtparser.y ${YACC} ${YFLAGS} -pDtParser -o$@ $? +prparserlex.c : $(ASL_COMPILER)/prparser.l + ${LEX} ${LFLAGS} -PPrParser -o$@ $? + +prparserparse.c prparserparse.h : $(ASL_COMPILER)/prparser.y + ${YACC} ${YFLAGS} -pPrParser -o$@ $? + + # Rename headers produced by bison/yacc +aslcompiler.y.h : aslcompilerparse.h + @echo Copy intermediate file: + @cp -f -v aslcompilerparse.h aslcompiler.y.h + dtparser.y.h: dtparserparse.h @echo Copy intermediate file: @cp -f -v dtparserparse.h dtparser.y.h -aslcompiler.y.h : aslcompilerparse.h +prparser.y.h: prparserparse.h @echo Copy intermediate file: - @cp -f -v aslcompilerparse.h aslcompiler.y.h + @cp -f -v prparserparse.h prparser.y.h # @@ -318,6 +341,12 @@ dtparserlex.o : dtparserlex.c dtparserparse.o : dtparserparse.c $(CC) -c $(CFLAGS) -Wall -Werror -Wstrict-aliasing=0 -o$@ $? +prparserlex.o : prparserlex.c + $(CC) -c $(CFLAGS) -Wall -Werror -Wstrict-aliasing=0 -o$@ $? + +prparserparse.o : prparserparse.c + $(CC) -c $(CFLAGS) -Wall -Werror -Wstrict-aliasing=0 -o$@ $? + %.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) Modified: vendor-sys/acpica/dist/source/compiler/aslcodegen.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcodegen.c Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslcodegen.c Tue Mar 20 18:17:33 2012 (r233237) @@ -264,7 +264,7 @@ CgWriteAmlOpcode ( /* These opcodes should not get here */ printf ("Found a node with an unassigned AML opcode\n"); - fprintf (stderr, "Found a node with an unassigned AML opcode\n"); + FlPrintFile (ASL_FILE_STDERR, "Found a node with an unassigned AML opcode\n"); return; case AML_INT_RESERVEDFIELD_OP: Modified: vendor-sys/acpica/dist/source/compiler/aslcompile.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompile.c Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslcompile.c Tue Mar 20 18:17:33 2012 (r233237) @@ -457,6 +457,17 @@ CmDoCompile ( Event = UtBeginEvent ("Open input and output files"); UtEndEvent (Event); + /* Preprocessor */ + + Event = UtBeginEvent ("Preprocess input file"); + PrDoPreprocess (); + UtEndEvent (Event); + if (Gbl_PreprocessOnly) + { + CmCleanupAndExit (); + return 0; + } + /* Build the parse tree */ Event = UtBeginEvent ("Parse source code and build parse tree"); @@ -474,8 +485,7 @@ CmDoCompile ( { AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL, "- Could not resolve parse tree root node"); - CmCleanupAndExit (); - return -1; + goto ErrorExit; } /* Optional parse tree dump, compiler debug output only */ @@ -508,12 +518,12 @@ CmDoCompile ( */ Event = UtBeginEvent ("Open AML output file"); Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); + UtEndEvent (Event); if (ACPI_FAILURE (Status)) { AePrintErrorLog (ASL_FILE_STDERR); return -1; } - UtEndEvent (Event); /* Interpret and generate all compile-time constants */ @@ -552,6 +562,7 @@ CmDoCompile ( AePrintErrorLog (ASL_FILE_STDERR); UtDisplaySummary (ASL_FILE_STDERR); } + UtEndEvent (FullCompile); return 0; } @@ -566,7 +577,7 @@ CmDoCompile ( UtEndEvent (Event); if (ACPI_FAILURE (Status)) { - return -1; + goto ErrorExit; } /* Namespace cross-reference */ @@ -575,7 +586,7 @@ CmDoCompile ( Status = LkCrossReferenceNamespace (); if (ACPI_FAILURE (Status)) { - return -1; + goto ErrorExit; } /* Namespace - Check for non-referenced objects */ @@ -646,6 +657,11 @@ CmDoCompile ( UtEndEvent (FullCompile); CmCleanupAndExit (); return 0; + +ErrorExit: + UtEndEvent (FullCompile); + CmCleanupAndExit (); + return (-1); } @@ -799,7 +815,9 @@ CmCleanupAndExit ( /* Close all open files */ - for (i = 2; i < ASL_MAX_FILE_TYPE; i++) + Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */ + + for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { FlCloseFile (i); } @@ -817,6 +835,18 @@ CmCleanupAndExit ( } } + /* Delete the preprocessor output file (.i) unless -li flag is set */ + + if (!Gbl_PreprocessorOutputFlag && Gbl_Files[ASL_FILE_PREPROCESSOR].Filename) + { + if (remove (Gbl_Files[ASL_FILE_PREPROCESSOR].Filename)) + { + printf ("%s: ", + Gbl_Files[ASL_FILE_PREPROCESSOR].Filename); + perror ("Could not delete preprocessor .i file"); + } + } + /* * Delete intermediate ("combined") source file (if -ls flag not set) * This file is created during normal ASL/AML compiles. It is not Modified: vendor-sys/acpica/dist/source/compiler/aslcompiler.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompiler.h Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslcompiler.h Tue Mar 20 18:17:33 2012 (r233237) @@ -75,6 +75,7 @@ #include "asltypes.h" #include "aslmessages.h" #include "aslglobal.h" +#include "preprocess.h" /******************************************************************************* @@ -84,7 +85,7 @@ ******************************************************************************/ /* - * parser - generated from flex/bison, lex/yacc, etc. + * Main ASL parser - generated from flex/bison, lex/yacc, etc. */ int AslCompilerparse( @@ -303,6 +304,16 @@ AslCommonError ( char *ExtraMessage); void +AslCommonError2 ( + UINT8 Level, + UINT8 MessageId, + UINT32 LineNumber, + UINT32 Column, + char *SourceLine, + char *Filename, + char *ExtraMessage); + +void AePrintException ( UINT32 FileId, ASL_ERROR_MSG *Enode, Modified: vendor-sys/acpica/dist/source/compiler/aslcompiler.y ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompiler.y Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslcompiler.y Tue Mar 20 18:17:33 2012 (r233237) @@ -78,6 +78,11 @@ void * AslLocalAllo #define YYDEBUG 1 /* Enable debug output */ #define YYERROR_VERBOSE 1 /* Verbose error messages */ +/* Define YYMALLOC/YYFREE to prevent redefinition errors */ + +#define YYMALLOC malloc +#define YYFREE free + /* * The windows version of bison defines this incorrectly as "32768" (Not negative). * We use a custom (edited binary) version of bison that defines YYFLAG as YYFBAD Modified: vendor-sys/acpica/dist/source/compiler/aslerror.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslerror.c Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslerror.c Tue Mar 20 18:17:33 2012 (r233237) @@ -55,6 +55,18 @@ AeAddToErrorLog ( ASL_ERROR_MSG *Enode); +/******************************************************************************* + * + * FUNCTION: AeClearErrorLog + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Empty the error list + * + ******************************************************************************/ + void AeClearErrorLog ( void) @@ -168,7 +180,7 @@ AePrintException ( UINT32 SourceColumn; UINT32 ErrorColumn; FILE *OutputFile; - FILE *SourceFile; + FILE *SourceFile = NULL; long FileSize; BOOLEAN PrematureEOF = FALSE; @@ -211,24 +223,28 @@ AePrintException ( OutputFile = Gbl_Files[FileId].Handle; - /* Use the merged header/source file if present, otherwise use input file */ - SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; - if (!SourceFile) + if (!Enode->SourceLine) { - SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle; - } + /* Use the merged header/source file if present, otherwise use input file */ - if (SourceFile) - { - /* Determine if the error occurred at source file EOF */ - - fseek (SourceFile, 0, SEEK_END); - FileSize = ftell (SourceFile); + SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; + if (!SourceFile) + { + SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle; + } - if ((long) Enode->LogicalByteOffset >= FileSize) + if (SourceFile) { - PrematureEOF = TRUE; + /* Determine if the error occurred at source file EOF */ + + fseek (SourceFile, 0, SEEK_END); + FileSize = ftell (SourceFile); + + if ((long) Enode->LogicalByteOffset >= FileSize) + { + PrematureEOF = TRUE; + } } } @@ -247,46 +263,59 @@ AePrintException ( if (Enode->LineNumber) { - fprintf (OutputFile, " %6u: ", Enode->LineNumber); - - /* - * If not at EOF, get the corresponding source code line and - * display it. Don't attempt this if we have a premature EOF - * condition. - */ - if (!PrematureEOF) + if (Enode->SourceLine) + { + fprintf (OutputFile, " %6u: %s", + Enode->LineNumber, Enode->SourceLine); + } + else { + if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_ASL) + fprintf (OutputFile, " %6u: ", + PrGetLineNumber (Enode->LineNumber)); + else + fprintf (OutputFile, " %6u: ", + Enode->LineNumber); + /* - * Seek to the offset in the combined source file, read - * the source line, and write it to the output. + * If not at EOF, get the corresponding source code line and + * display it. Don't attempt this if we have a premature EOF + * condition. */ - Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, - (int) SEEK_SET); - if (Actual) + if (!PrematureEOF) { - fprintf (OutputFile, - "[*** iASL: Seek error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - } - else - { - RActual = fread (&SourceByte, 1, 1, SourceFile); - if (!RActual) + /* + * Seek to the offset in the combined source file, read + * the source line, and write it to the output. + */ + Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, + (int) SEEK_SET); + if (Actual) { fprintf (OutputFile, - "[*** iASL: Read error on source code temp file %s ***]", + "[*** iASL: Seek error on source code temp file %s ***]", Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); } - - else while (RActual && SourceByte && (SourceByte != '\n')) + else { - fwrite (&SourceByte, 1, 1, OutputFile); RActual = fread (&SourceByte, 1, 1, SourceFile); + if (!RActual) + { + fprintf (OutputFile, + "[*** iASL: Read error on source code temp file %s ***]", + Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); + } + + else while (RActual && SourceByte && (SourceByte != '\n')) + { + fwrite (&SourceByte, 1, 1, OutputFile); + RActual = fread (&SourceByte, 1, 1, SourceFile); + } } } - } - fprintf (OutputFile, "\n"); + fprintf (OutputFile, "\n"); + } } } else @@ -295,7 +324,16 @@ AePrintException ( if (Enode->LineNumber) { - fprintf (OutputFile, "(%u) : ", Enode->LineNumber); + if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_ASL) + { + fprintf (OutputFile, "(%u) i:%6u : ", + PrGetLineNumber (Enode->LineNumber), Enode->LineNumber); + } + else + { + fprintf (OutputFile, "(%u) i:%6u : ", + Enode->LineNumber, Enode->LineNumber); + } } } } @@ -421,6 +459,91 @@ AePrintErrorLog ( /******************************************************************************* * + * FUNCTION: AslCommonError2 + * + * PARAMETERS: Level - Seriousness (Warning/error, etc.) + * MessageId - Index into global message buffer + * LineNumber - Actual file line number + * Column - Column in current line + * SourceLine - Actual source code line + * Filename - source filename + * ExtraMessage - additional error message + * + * RETURN: None + * + * DESCRIPTION: Create a new error node and add it to the error log + * + ******************************************************************************/ + +void +AslCommonError2 ( + UINT8 Level, + UINT8 MessageId, + UINT32 LineNumber, + UINT32 Column, + char *SourceLine, + char *Filename, + char *ExtraMessage) +{ + char *MessageBuffer = NULL; + char *LineBuffer; + ASL_ERROR_MSG *Enode; + + + Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG)); + + if (ExtraMessage) + { + /* Allocate a buffer for the message and a new error node */ + + MessageBuffer = UtLocalCalloc (strlen (ExtraMessage) + 1); + + /* Keep a copy of the extra message */ + + ACPI_STRCPY (MessageBuffer, ExtraMessage); + } + + LineBuffer = UtLocalCalloc (strlen (SourceLine) + 1); + ACPI_STRCPY (LineBuffer, SourceLine); + + /* Initialize the error node */ + + if (Filename) + { + Enode->Filename = Filename; + Enode->FilenameLength = strlen (Filename); + if (Enode->FilenameLength < 6) + { + Enode->FilenameLength = 6; + } + } + + Enode->MessageId = MessageId; + Enode->Level = Level; + Enode->LineNumber = LineNumber; + Enode->LogicalLineNumber = LineNumber; + Enode->LogicalByteOffset = 0; + Enode->Column = Column; + Enode->Message = MessageBuffer; + Enode->SourceLine = LineBuffer; + + /* Add the new node to the error node list */ + + AeAddToErrorLog (Enode); + + if (Gbl_DebugFlag) + { + /* stderr is a file, send error to it immediately */ + + AePrintException (ASL_FILE_STDERR, Enode, NULL); + } + + Gbl_ExceptionCount[Level]++; +} + + +/******************************************************************************* + * * FUNCTION: AslCommonError * * PARAMETERS: Level - Seriousness (Warning/error, etc.) @@ -487,6 +610,7 @@ AslCommonError ( Enode->LogicalByteOffset = LogicalByteOffset; Enode->Column = Column; Enode->Message = MessageBuffer; + Enode->SourceLine = NULL; /* Add the new node to the error node list */ @@ -553,7 +677,6 @@ AslError ( break; } - if (Op) { AslCommonError (Level, MessageId, Op->Asl.LineNumber, @@ -643,5 +766,3 @@ AslCompilererror ( return 0; } - - Modified: vendor-sys/acpica/dist/source/compiler/aslfiles.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslfiles.c Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslfiles.c Tue Mar 20 18:17:33 2012 (r233237) @@ -50,7 +50,7 @@ /* Local prototypes */ -static FILE * +FILE * FlOpenIncludeWithPrefix ( char *PrefixDir, char *Filename); @@ -363,14 +363,13 @@ FlCloseFile ( } Error = fclose (Gbl_Files[FileId].Handle); - Gbl_Files[FileId].Handle = NULL; - if (Error) { FlFileError (FileId, ASL_MSG_CLOSE); AslAbort (); } + Gbl_Files[FileId].Handle = NULL; return; } @@ -478,7 +477,7 @@ FlAddIncludeDirectory ( * ******************************************************************************/ -static FILE * +FILE * FlOpenIncludeWithPrefix ( char *PrefixDir, char *Filename) @@ -740,6 +739,13 @@ FlOpenMiscOutputFiles ( Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = freopen (Filename, "w+t", stderr); + if (!Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle) + { + AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME, + 0, 0, 0, 0, NULL, NULL); + return (AE_ERROR); + } + AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT); AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT); } @@ -764,12 +770,26 @@ FlOpenMiscOutputFiles ( AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT); } + /* Create the preprocessor output file */ + + Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROCESSOR); + if (!Filename) + { + AslCommonError (ASL_ERROR, ASL_MSG_PREPROCESSOR_FILENAME, + 0, 0, 0, 0, NULL, NULL); + return (AE_ERROR); + } + + FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+b"); + + /* All done for data table compiler */ + if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) { return (AE_OK); } - /* Create/Open a combined source output file */ + /* Create/Open a combined source output file */ Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE); if (!Filename) @@ -786,6 +806,10 @@ FlOpenMiscOutputFiles ( */ FlOpenFile (ASL_FILE_SOURCE_OUTPUT, Filename, "w+b"); +/* +// TBD: TEMP +// AslCompilerin = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; +*/ /* Create/Open a assembly code source output file if asked */ if (Gbl_AsmOutputFlag) Modified: vendor-sys/acpica/dist/source/compiler/aslglobal.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslglobal.h Tue Mar 20 18:05:15 2012 (r233236) +++ vendor-sys/acpica/dist/source/compiler/aslglobal.h Tue Mar 20 18:17:33 2012 (r233237) @@ -70,10 +70,11 @@ extern int yyde extern FILE *AslCompilerin; extern int AslCompilerdebug; extern int DtParserdebug; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Tue Mar 20 18:18:13 2012 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 681401065675; Tue, 20 Mar 2012 18:18:13 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A8A88FC08; Tue, 20 Mar 2012 18:18:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KIIDM4031644; Tue, 20 Mar 2012 18:18:13 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KIIDMp031643; Tue, 20 Mar 2012 18:18:13 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201203201818.q2KIIDMp031643@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 20 Mar 2012 18:18:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233238 - vendor-sys/acpica/20120320 X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 18:18:13 -0000 Author: jkim Date: Tue Mar 20 18:18:12 2012 New Revision: 233238 URL: http://svn.freebsd.org/changeset/base/233238 Log: Tag ACPICA 20120320. Added: vendor-sys/acpica/20120320/ - copied from r233237, vendor-sys/acpica/dist/