From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Bastian Beischer Newsgroups: gmane.emacs.help Subject: Re: Semantic mode for c++ Date: Mon, 26 Jun 2017 15:42:13 +0200 Message-ID: References: <11d06dbd-0321-ca9a-3967-3dab2cf61b6d@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1498489039 7803 195.159.176.226 (26 Jun 2017 14:57:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Jun 2017 14:57:19 +0000 (UTC) Cc: Help-Gnu-Emacs To: Gabriele Labita Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 26 16:57:15 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPVRy-0001Xz-Es for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Jun 2017 16:57:14 +0200 Original-Received: from localhost ([::1]:47059 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPVRy-0005hb-J0 for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Jun 2017 10:57:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPUHS-0004rZ-41 for help-gnu-emacs@gnu.org; Mon, 26 Jun 2017 09:42:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPUHQ-000396-Iw for help-gnu-emacs@gnu.org; Mon, 26 Jun 2017 09:42:18 -0400 Original-Received: from mail-ot0-x229.google.com ([2607:f8b0:4003:c0f::229]:33061) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPUHQ-000385-Ay for help-gnu-emacs@gnu.org; Mon, 26 Jun 2017 09:42:16 -0400 Original-Received: by mail-ot0-x229.google.com with SMTP id y47so1242290oty.0 for ; Mon, 26 Jun 2017 06:42:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=OcfgGflQv1YBHQeiIqA2/Ziuatlu09z3xoxAFUQPTNU=; b=BBeVVeqKRH9Fb0uyXAvLFfyaQcNR5Sx2SZYpg/QphqVReK3NosScTM9CIng41geMUJ 2QsnCQOAcSrvSKLlnm9myjafQSLmfq79PXC54e3HDSjeMqrVBTuNZeFndB7nJBBraHg0 GspcMSWQZN2CSP2SiRMM5kowMYpYN+bw19+MWjmGxRRYu1qkRsqPsp10A7u9aQK/MHmb ymQbjiBj74y0RT05Dk7OFv7zKxlwYDfd/tMv0wPfAIB+yRMNVm0WefC76L1owvwycbWq rXpH0FjTeep+U+XtnQZhNuIIiSuGKh3OkRN79yY+Dkc+GaiMiiEb3E4ke25HZQn3n+wJ 528A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=OcfgGflQv1YBHQeiIqA2/Ziuatlu09z3xoxAFUQPTNU=; b=a3r0Q1aJUezbEIiDLN4/MZLPmHwLq32yXJSYC0FLj9nvvZ3+drSYjMr2y1fdZsbHpq 29kY3Qeq4892frPL5pwMMBoWuCIboo+4h5cvQ74947NW0NdBm/TqEjWwn2c2hmCuJuWJ g7PkfXwfgjFA7R4MXEmdBnfTMzool2yBMe4lleKI+WgNFl55pECj8AtL+Niv7pEOfcIV TvflveUnmPXmZCrPGntOpu3JAqI6amIjHtbFEb3UvXfSs2kb/wFrhyX45NEun6mRu9cb 3hDImAvCupBAXDk25DGmwki+8TsQa8T2siOlAGsYUtCYFsL0P6J/fygXV79XmUnmDjn3 YiKQ== X-Gm-Message-State: AKS2vOzplQUkqOrU1I1J2qaTBZHigZkouQnAxCa+TQJcLHH1y0yqsoB2 4vNfZDQhz37Ppv40jkqkCf5Hb3tXmw== X-Received: by 10.157.63.8 with SMTP id m8mr157877otc.4.1498484533862; Mon, 26 Jun 2017 06:42:13 -0700 (PDT) Original-Received: by 10.202.98.137 with HTTP; Mon, 26 Jun 2017 06:42:13 -0700 (PDT) In-Reply-To: <11d06dbd-0321-ca9a-3967-3dab2cf61b6d@gmail.com> X-Google-Sender-Auth: NWsNi81UYMPikfhx49Hkj26scvA X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::229 X-Mailman-Approved-At: Mon, 26 Jun 2017 10:56:16 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:113584 Archived-At: Hey, I guess the problem is that the semantic lexer does not set the correct preprocessor macros when lexing the STL include files. In particular, to set the C++ standard version, one has to set the __cplusplus macro to a particular value. The compiler does this automatically for you when you compile with -std=XXX, but semantic does not know anything about this compiler flag. You can customize the macro definitions used in semantic in the variable "semantic-lex-c-preprocessor-symbol-map". However, I don't think semantic currently supports all the new C++11 and above keywords which have entered the language when parsing code, so you might get mixed results. Cheers Bastian On Mon, Jun 26, 2017 at 2:34 PM, Gabriele Labita wrote: > Hi, > I'm trying to configure semantic module to have auto completion for c++ in > emacs. > I put this code on .emacs file: > > ``` > (add-hook 'c-mode-common-hook > '(lambda () (load (concat custom-config-path > "custom-config-c++.el"))) > ) > ``` > > And this is my custom-config-c++.el file: > ``` > (add-to-list 'semantic-default-submodes 'global-semantic-idle-schedule > r-mode) > (add-to-list 'semantic-default-submodes 'global-semantic-idle-completi > ons-mode) > (add-to-list 'semantic-default-submodes 'global-semantic-idle-summary- > mode) > (add-to-list 'semantic-default-submodes 'global-semanticdb-minor-mode) > (add-to-list 'semantic-default-submodes 'global-semantic-show-parser-s > tate-mode) > (add-to-list 'semantic-default-submodes 'global-semantic-show-unmatche > d-syntax-mode) > > (semantic-mode 1) > > (require 'semantic/ia) > (require 'semantic/bovine/gcc) > > (semanticdb-enable-gnu-global-databases 'c++-mode) > > (global-ede-mode t) > > (global-flycheck-mode t) > (setq flycheck-gcc-language-standard "c++14") > ;; To add library use follow command: > ;; > flycheck-pkg-config > > ;; 70 Columns RULE > (require 'whitespace) > (setq whitespace-line-column 71) > (setq whitespace-style '(face lines-tail)) > > (global-whitespace-mode +1) > ``` > > It works well but I've a annoying problem: when I use the command: > 'semantic-ia-complete-symbol' on 'std::', the semantic db is created in the > .emacs.d/semanticdb/ folder. The problem is that the created db refers to > c++98 instead of c++14. For example: when auto complete smart pointers, I > find the "auto_ptr" suggestion and not "unique_ptr" or "shared_ptr". > How can I generate the right db? > > More Infos: > - Debian 9 amd 64 > - gcc 6.3.0 > - Emacs 24.5.1 > - global 6.5.6 > > -- Bastian Beischer RWTH Aachen University of Technology @RWTH Aachen Office: 28 C 203 Phone: +49-241-80-27205 E-mail: beischer@physik.rwth-aachen.de Address: I. Physikalisches Institut B, Sommerfeldstr. 14, D-52074 Aachen @CERN Office: Bdg 32-4-B12 Phone: +41-22-76-75750 E-mail: bastian.beischer@cern.ch Address: CERN, CH-1211 Geneve 23