From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Welsh Duggan Newsgroups: gmane.emacs.bugs Subject: bug#11749: Acknowledgement (24.1; C-mode indentation gives wrong-type-argument error.) Date: Tue, 09 Oct 2012 10:05:07 -0400 Message-ID: References: <503D4B11.6000501@cua.dk> <20120902211620.GA3824@acm.acm> <50447C94.2040402@cua.dk> <20120905204821.GA3620@acm.acm> <87ipbqpkb7.fsf@maru.md5i.com> <20120908211451.GA22477@acm.acm> <20121007105951.GA3194@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1349791554 10525 80.91.229.3 (9 Oct 2012 14:05:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Oct 2012 14:05:54 +0000 (UTC) Cc: "11749@debbugs.gnu.org" <11749@debbugs.gnu.org>, Kim Storm To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 09 16:06:00 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TLaRa-0008TE-Lr for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Oct 2012 16:05:59 +0200 Original-Received: from localhost ([::1]:44622 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLaRU-0007w6-Gh for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Oct 2012 10:05:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLaRQ-0007vy-8f for bug-gnu-emacs@gnu.org; Tue, 09 Oct 2012 10:05:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLaRH-0003WN-0B for bug-gnu-emacs@gnu.org; Tue, 09 Oct 2012 10:05:48 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLaR9-0003PE-7m; Tue, 09 Oct 2012 10:05:31 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TLaRe-0004TB-6H; Tue, 09 Oct 2012 10:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Welsh Duggan Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Tue, 09 Oct 2012 14:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11749 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 11749-submit@debbugs.gnu.org id=B11749.134979155617169 (code B ref 11749); Tue, 09 Oct 2012 14:06:02 +0000 Original-Received: (at 11749) by debbugs.gnu.org; 9 Oct 2012 14:05:56 +0000 Original-Received: from localhost ([127.0.0.1]:35736 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TLaRX-0004Sr-7Y for submit@debbugs.gnu.org; Tue, 09 Oct 2012 10:05:56 -0400 Original-Received: from upton.red.cert.org ([192.88.209.60]:55502) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TLaRT-0004Sb-G9 for 11749@debbugs.gnu.org; Tue, 09 Oct 2012 10:05:53 -0400 Original-Received: from bucknell.indigo.cert.org (bucknell.indigo.cert.org [10.60.10.121]) by upton.red.cert.org (8.14.4/8.14.4) with ESMTP id q99E59Yd018430; Tue, 9 Oct 2012 10:05:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cert.org; s=jthatj15xw2j; t=1349791509; bh=WmEVhmKh2upFYtlUC1wMDlUwBSNtiiNRXJkL32ldoa4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type:Sender:Reply-To; b=CmiGPZMe9FhBS2zrAQy/t+3rv7Yf+oRf8MJ3+hacTWtcZkCdCZ8Rv8fs0hw5artQo IQvWNF1Q4wIGs9LeW7zlW9Ac0HiHd1xg9Y8q1GtBchEGRcTeQzfjgigKSfyGbJTxNp ag+JZwe8cqzl1jobnrsjM8X+lMFmi4ruwFxDLMgM= Original-Received: from waterbuck.yellow.cert.org (waterbuck.yellow.cert.org [10.20.128.84]) by bucknell.indigo.cert.org (8.14.4/8.14.4/2.81) with ESMTP id q99E599i012075; Tue, 9 Oct 2012 10:05:09 -0400 Original-Received: (from mwd@localhost) by waterbuck.yellow.cert.org (8.14.4/8.14.4/Submit/1.6) id q99E57lQ017016; Tue, 9 Oct 2012 10:05:07 -0400 X-Authentication-Warning: waterbuck.yellow.cert.org: mwd set sender to mwd@cert.org using -f In-Reply-To: <20121007105951.GA3194@acm.acm> (Alan Mackenzie's message of "Sun, 7 Oct 2012 06:59:51 -0400") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:65420 Archived-At: --=-=-= Content-Type: text/plain Alan Mackenzie writes: > Hi, Michael. > > On Fri, Sep 21, 2012 at 01:47:15PM -0400, Michael Welsh Duggan wrote: >> Michael Welsh Duggan writes: > >> > Michael Welsh Duggan writes: > >> >>>> There is generally no way to re-create it, so I've stopped reporting >> >>>> these. I wish there were some way to record all actions in c-mode >> >>>> buffers such that they could be saved and re-played when this type of >> >>>> problem happens. If there were some sort of debug flag I could turn >> >>>> on, I would turn it on by default and hopefully be able to catch some >> >>>> useful information. > >> >>> M-x c-toggle-parse-state-debug > >> >>> (or (c-toggle-parse-state-debug 1) in your .emacs). Warning: variable >> >>> `c-debug-parse-state' is not buffer local. I wrote this on 19th October >> >>> last year to help sort out the bug you reported a little earlier. :-) > >> >>> It works by calculating c-parse-state twice for each call - The first >> >>> time normally, then again with the internal state bound to "newly >> >>> initialised". If the the two results differ, they are printed to >> >>> *Messages*, together with the saved previous state. If this does >> >>> trigger, please note any recent buffer changes. It may make editing >> >>> intolerably slow. > >> >> I will turn this on. > >> I turned this on, and inserted a (ding) where cc-mode outputs an >> inconsistency message. I can barely stand to edit code now, due to >> what seem to be almost every key press causing a beep. Have you made >> any progress here, or do you need more data? > > I have found the bug which is causing (most of) these dings, though I > don't think it is the one which caused Kim's original bug. Could you try > out the patch below, please. (I have also enhanced/corrected the > debugging routines a bit, too.) Still doesn't seem to help much here. I have attached a file which reliably causes a cache failure. I have attached the smallest file of the set of files I am working on that causes this particular problem. Load the attached file and toggle on parse state debugging. Then scroll to the bottom of the file. (Use C-v multiple times, or just M->.) One reason I have attached this file is that it only triggers the warning message once. Most of my larger files cause this to happen quite a lot. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=mod_fan_in.lzz /* ** Copyright (C) 2012 by Carnegie Mellon University. ** ** @OPENSOURCE_HEADER_START@ ** ** Use of the SILK system and related source code is subject to the terms ** of the following licenses: ** ** GNU Public License (GPL) Rights pursuant to Version 2, June 1991 ** Government Purpose License Rights (GPLR) pursuant to DFARS 252.227.7013 ** ** NO WARRANTY ** ** ANY INFORMATION, MATERIALS, SERVICES, INTELLECTUAL PROPERTY OR OTHER ** PROPERTY OR RIGHTS GRANTED OR PROVIDED BY CARNEGIE MELLON UNIVERSITY ** PURSUANT TO THIS LICENSE (HEREINAFTER THE "DELIVERABLES") ARE ON AN ** "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY ** KIND, EITHER EXPRESS OR IMPLIED AS TO ANY MATTER INCLUDING, BUT NOT ** LIMITED TO, WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE, ** MERCHANTABILITY, INFORMATIONAL CONTENT, NONINFRINGEMENT, OR ERROR-FREE ** OPERATION. CARNEGIE MELLON UNIVERSITY SHALL NOT BE LIABLE FOR INDIRECT, ** SPECIAL OR CONSEQUENTIAL DAMAGES, SUCH AS LOSS OF PROFITS OR INABILITY ** TO USE SAID INTELLECTUAL PROPERTY, UNDER THIS LICENSE, REGARDLESS OF ** WHETHER SUCH PARTY WAS AWARE OF THE POSSIBILITY OF SUCH DAMAGES. ** LICENSEE AGREES THAT IT WILL NOT MAKE ANY WARRANTY ON BEHALF OF ** CARNEGIE MELLON UNIVERSITY, EXPRESS OR IMPLIED, TO ANY PERSON ** CONCERNING THE APPLICATION OF OR THE RESULTS TO BE OBTAINED WITH THE ** DELIVERABLES UNDER THIS LICENSE. ** ** Licensee hereby agrees to defend, indemnify, and hold harmless Carnegie ** Mellon University, its trustees, officers, employees, and agents from ** all claims or demands made against them (and any related losses, ** expenses, or attorney's fees) arising out of, or relating to Licensee's ** and/or its sub licensees' negligent use or willful misuse of or ** negligent conduct or willful misconduct regarding the Software, ** facilities, or other rights or assistance granted by Carnegie Mellon ** University under this License, including, but not limited to, any ** claims of product liability, personal injury, death, damage to ** property, or violation of any laws or regulations. ** ** Carnegie Mellon University Software Engineering Institute authored ** documents are sponsored by the U.S. Department of Defense under ** Contract FA8721-05-C-0003. Carnegie Mellon University retains ** copyrights in all material produced under this contract. The U.S. ** Government retains a non-exclusive, royalty-free license to publish or ** reproduce these documents, or allow others to do so, for U.S. ** Government purposes only pursuant to the copyright license under the ** contract clause at 252.227.7013. ** ** @OPENSOURCE_HEADER_END@ */ /* ** mod_fan_in.lzz ** ** Implementation of the "Fan-In" module. ** ** The Fan-In module copies blocks of data from a user-specified ** number of inputs to one output. ** */ #hdr #include RCSIDENTVAR(rcsID_MOD_FAN_OUT_H, "$Id$"); #include "module.hh" #end #src RCSIDENT("$Id$"); #include "modsys.hh" #define MOD_FAN_IN_CLASS_NAME "Fan-In" #define DEFAULT_READ_BLOCK_SIZE 10000 #end namespace silk { class ModFanIn : public Module { friend int mod_fan_in_so_loader( uint16_t major_version, uint16_t minor_version, void *so_loader_data); private: static const Module::port_t ports_out[] = { {"out", "Record output"}, SK_MODULE_PORT_SENTINEL }; std::vector ports_in; std::vector port_names; enum params_id_t { OPT_INPUT_COUNT }; /** The definition of parameters for the ModFanOut module. */ struct class_params_t { /** name of the parameter */ const char *key; /** an integer identifier for it */ int val; /** min number of values it supports */ long lower; /** max number of values it supports */ long upper; /** description of parameter */ const char *description; }; static ModFanIn::class_params_t class_params[] = { {"input_count", OPT_INPUT_COUNT, 1, -1, "Number of input connectors to create"}, {0, 0, 0, 0, 0} /* sentinel entry */ }; ModFanIn() { conns_out.push_back(NULL); } ~ModFanIn() {} public: const char *get_type(void) const { return MOD_FAN_IN_CLASS_NAME; } private: static Module *_create() { return new ModFanIn(); } void _init() { unsigned int i; if (conns_out[0] == NULL) { std::ostringstream os; os << "The " << get_type() << " module's " << ports_out[0].name << " connector is not connected"; throw sk_error_module_bad_param_t(os); } for (i = 0; i < conns_in.size(); i++) { if (conns_in[i]) { continue; } std::ostringstream os; os << "The " << get_type() << " module's " << ports_in[i].name << " connector is not connected"; throw sk_error_module_bad_param_t(os); } } void _run() { std::vector ready; std::vector::iterator conn; Connector *out = conns_out[0]; void *in_block; void *out_block = NULL; size_t in_size; size_t out_size; size_t active_inputs; int rv; /* create and initialize the connector poll object */ PollConn poller(PollConn::READ); for (conn = conns_in.begin(); conn != conns_in.end(); ++conn) { (*conn)->add_to_poll(&poller); } active_inputs = conns_in.size(); /* run until no one is giving us data */ while (active_inputs > 0) { /* Which of the upstream connectors have data? If none have * data, wait forever for data to become available. */ poller.poll(1, ready); if (stopped || ready.empty()) { goto END; } in_size = DEFAULT_READ_BLOCK_SIZE; /* Process all the connectors that have data */ for (conn = ready.begin(); conn != ready.end(); ++conn) { rv = (*conn)->get_read_block(&in_block, &in_size); if (rv) { --active_inputs; (*conn)->remove_from_poll(&poller); continue; } /* Copy the block to the downstream connector */ out_size = in_size; rv = out->get_write_block(&out_block, &out_size); if (rv || stopped) { (*conn)->return_read_block(in_block); goto END; } if (stopped) { (*conn)->return_read_block(in_block); goto END; } assert(out_size >= in_size); memcpy(out_block, in_block, in_size); out->return_write_block(out_block, in_size); out_block = NULL; (*conn)->return_read_block(in_block); if (stopped) { goto END; } } } END: if (out_block) { out->return_read_block(out_block); } out->stop_no_more_data(); for (conn = conns_in.begin(); conn != conns_in.end(); ++conn) { (*conn)->stop(); try { (*conn)->remove_from_poll(&poller); } catch (sk_error_conn_poll_add_remove_t &e) { // ignore this exception } } } void _get_ports( std::vector &inputs, std::vector &outputs) { const Module::port_t *port; inputs = ports_in; outputs.clear(); for (port = ports_out; port->name; ++port) { outputs.push_back(*port); } } static Parameterized::param_registry_t *create_param_registry() { param_registry_t *registry = new param_registry_t(); class_params_t *param = class_params; while (param->key) { registry->insert( Definition(param->key, param->description, ¶m->val, param->lower, param->upper)); ++param; } return registry; } static std::auto_ptr param_registry = std::auto_ptr( ModFanIn::create_param_registry()); const Parameterized::param_registry_t& get_param_registry() const { return *param_registry; } void _set_param( const Definition& defn, const std::vector& values) throw (Error) { int rv; uint32_t u32; unsigned int i; switch (*(params_id_t *)(defn.get_context())) { case OPT_INPUT_COUNT: if (!conns_in.empty()) { std::ostringstream os; os << "Invalid " << defn.get_name() << " '" << values[0] << "': Cannot change value once connectors are created"; throw sk_error_module_bad_param_t(os); } rv = skStringParseUint32(&u32, values[0].c_str(), 1, 0); if (rv) { goto PARSE_ERROR; } for (i = 0; i < u32; i++) { Module::port_t port = {NULL, NULL}; char name[32]; snprintf(name, sizeof(name), "in.%u", i); port_names.push_back(name); port.name = port_names.back().c_str(); ports_in.push_back(port); conns_in.push_back(NULL); } break; } return; PARSE_ERROR: std::ostringstream os; os << "Invalid " << defn.get_name() << " '" << values[0] << "': " << skStringParseStrerror(rv); throw sk_error_conn_param_value_t(os.str()); } }; int mod_fan_in_so_loader( uint16_t major_version, uint16_t minor_version, void *so_loader_data) { ModuleSystem::loader_data_t *so_loader = static_cast(so_loader_data); ModuleSystem *module_system = so_loader->modsys; // ADD VERSION CHECK try { module_system->register_module( MOD_FAN_IN_CLASS_NAME, &ModFanIn::_create); } catch (Error &e) { skAppPrintErr("Failed to load " MOD_FAN_IN_CLASS_NAME ": %s", e.get_string().c_str()); return -1; } catch (...) { skAppPrintErr("Failed to load " MOD_FAN_IN_CLASS_NAME ": %s", "Unknown error"); return -1; } return 0; } } /* ** Local Variables: ** mode:c++ ** indent-tabs-mode:nil ** c-basic-offset:4 ** End: */ --=-=-= Content-Type: text/plain -- Michael Welsh Duggan (mwd@cert.org) --=-=-=--