From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Gabriele Labita Newsgroups: gmane.emacs.help Subject: Re: Semantic mode for c++ Date: Mon, 26 Jun 2017 23:32:19 +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 1498512787 23433 195.159.176.226 (26 Jun 2017 21:33:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Jun 2017 21:33:07 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 26 23:33:03 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 1dPbd0-0005qA-9q for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Jun 2017 23:33:02 +0200 Original-Received: from localhost ([::1]:49105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPbd5-0004gM-Ch for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Jun 2017 17:33:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPbcN-0004e1-Fu for help-gnu-emacs@gnu.org; Mon, 26 Jun 2017 17:32:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPbcL-0006kR-Qq for help-gnu-emacs@gnu.org; Mon, 26 Jun 2017 17:32:23 -0400 Original-Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:38088) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPbcL-0006k9-Gz for help-gnu-emacs@gnu.org; Mon, 26 Jun 2017 17:32:21 -0400 Original-Received: by mail-wm0-x229.google.com with SMTP id b184so9303096wme.1 for ; Mon, 26 Jun 2017 14:32:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=ZXJqH2oqwMfajCaWPI1p7GhpDJiHQ0sH62PdWbxWoas=; b=mujxCf019r0CTVpGxXUD7QK75SEh5LjTrncIoPL1GvMkjvBMgJZ2aRhQWAIOnuslgA zSmbPHxMjVr+Eo/qi6XXW9juXCvVupRoxJ1WerHbi9GcfxevMijylbORwbVAP9E2HzUb W1xxmESOS637ejaSMt+jkt0tFYe+TfuoYeadmdK2910OE1wx5cwK+ED3KaCRfO1JT5Wr FjJrR9o+PRTEX0fKjcsgGnDCiM6BNbY1oSpkmpsnrgJF9f+0YRsspFXaTaMjIK6iG+Mp LYFE1vGEVWzuQhj+/RPL9tmtySa+FoWfvWm1DzCMGIVGrJHpmVmXbeUizBjtFYkKQRtb CZgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=ZXJqH2oqwMfajCaWPI1p7GhpDJiHQ0sH62PdWbxWoas=; b=qqGKxniNMeixlQcmY+iMjU0y/Q/J70O6E1XyOrbL9+Xuj3aJ15oTUR7qFyyw/ZEnei /o3SdZdGyi9z8umMC2VZqQE6i7P7wl1EvcrRyngJ4bh+GOeapgrTUeoutksiBqojiqlJ xQtk+QHtZICc5uDbR5yOikkwTPMOQ0k4IoHnHmb5OwMOucYJqm7GcjufW2P5GzKbIRWd Hq4OnL1lAckNisErDXuQljJ674ngm4KQotUbN1f3BrTckUohv5zAAR/fA2sKWrV+HaFU zCbOfjRHa1MGTc7Pta0Ug8F9R+oaaCiPfxNM3pklMHUPKfg4gri+grzS3o4/hGVSsyra ie6Q== X-Gm-Message-State: AKS2vOxGrif3wPstWOIDI0RAAXaU7vJmipT7i3uoOHP56xlC47NsLfvG PUwjbaeBPQ1lIvxRYM0yUBtvh27jwiwEaL0= X-Received: by 10.80.184.24 with SMTP id j24mr1402973ede.176.1498512740211; Mon, 26 Jun 2017 14:32:20 -0700 (PDT) Original-Received: by 10.80.182.207 with HTTP; Mon, 26 Jun 2017 14:32:19 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::229 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:113587 Archived-At: Hi, Thank you for the reply. I've checked the "semantic-lex-c-preprocessor-symbol-map" and I found: ("__cplusplus" . "201402L") I think it is right, because reading the code of stl I found this kind of preprocessor directives: #if __cplusplus > 201103L Maybe the problem to be the missing support for new C++11. As you say I've got a mixed result. Is there an other emacs package to do the same thing? I found something on the net, but all of them use "clang" and I prefer to not install it. I would like to use g++. Gabriele L. P.s. When I tried to reply through client mail I had some errors. I saw on browser that it sent about 12 mail. I don't know what happen but I'm very sorry for the inconvenience. Ignore all previous mail. 2017-06-26 15:42 GMT+02:00 Bastian Beischer : > 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 < > gabriele.labita@gmail.com> 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 <+49%20241%208027205> > 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 > -- Gabriele Labita