www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4899] New: Ddoc's warnings about stray parens should include file and line numbers

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4899

           Summary: Ddoc's warnings about stray parens should include file
                    and line numbers
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jmdavisProg gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg gmx.com> 2010-09-19 20:38:07
PDT ---
Ddoc can produce these two warnings:

Warning: Ddoc: Stray '('. This may cause incorrect Ddoc output. Use $(LPAREN)
instead for unpaired left parentheses.

Warning: Ddoc: Stray ')'. This may cause incorrect Ddoc output. Use $(RPAREN)
instead for unpaired right parentheses.


However, if you'll notice, they don't specify which file or line number the
warning is for. So, the warning borders on useless. It really should specify
the file and line number where the problem is.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 19 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4899


Johannes Pfau <johannespfau gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johannespfau gmail.com


--- Comment #1 from Johannes Pfau <johannespfau gmail.com> 2010-09-20 07:43:56
PDT ---
Printing line numbers is implemented and should work. It works with the test
case in 3554.

test.d(6): Warning: Ddoc: Stray '('. This may cause incorrect Ddoc output. Use
$(LPAREN) instead for unpaired left parentheses.
test.d(16): Warning: Ddoc: Stray ')'. This may cause incorrect Ddoc output. Use
$(RPAREN) instead for unpaired right parentheses.

Could you provide a test case where the line numbers aren't printed?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 20 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4899



--- Comment #2 from Jonathan M Davis <jmdavisProg gmx.com> 2010-09-20 23:47:02
PDT ---
/++
       (See accompanying file LICENSE_1_0.txt or copy at
        http://www.boost.org/LICENSE_1_0.txt)
+/
module d;

void main()
{
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 20 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4899



--- Comment #3 from Johannes Pfau <johannespfau gmail.com> 2010-09-21 07:38:26
PDT ---
OK, I can confirm that.
So the line information is missing if the comment is a module comment. The dmd
main function calls Module::gendocfile() which calls
DocComment::writeSections() directly. In this case the Module's loc member is
never set and therefore the line information is missing, I don't know how to
fix this though.

In case you're interested why the parenthesis error occurs:
The second line in the comment, "http://www.boost.org/LICENSE_1_0.txt)" is the
problem. Because of the colon dmd thinks you define a ddoc section named "http"
with content "//www.boost.org/LICENSE_1_0.txt)". Because parenthesis must be
closed in the section they were opened in the stray parenthesis error occurs.

Possible workarounds are:
1. Join those two lines into one
2. Section names cannot contain spaces, so move the 'at' to the second line
(See accompanying file LICENSE_1_0.txt or copy
at http://www.boost.org/LICENSE_1_0.txt)
3. Use a macro. _Every_ macro will work
(See accompanying file LICENSE_1_0.txt or copy at
$(LINK http://www.boost.org/LICENSE_1_0.txt))

(See accompanying file LICENSE_1_0.txt or copy at
$(TEXT http://www.boost.org/LICENSE_1_0.txt))
Macros:
  TEXT=$0

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 21 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4899



--- Comment #4 from Jonathan M Davis <jmdavisProg gmx.com> 2010-09-21 09:40:52
PDT ---
I did #1 in my code once I figured out what was generating the error, but
that's from the license declaration used at the top of pretty much every module
in Phobos, so unless they were changed recently, they're likely all generating
this error if compiled with -w (I'm not sure whether Phobos is normally
compiled with -w or not though).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 21 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4899


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ddoc, pull
           Platform|Other                       |All
         OS/Version|Linux                       |All


--- Comment #5 from Kenji Hara <k.hara.pg gmail.com> 2013-07-01 18:30:07 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2291

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 01 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4899



--- Comment #6 from github-bugzilla puremagic.com 2013-07-02 05:10:36 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/328969f671c9fcdc2fb7b9ba7ae65e483074961d
fix Issue 4899 - Ddoc: Warnings about stray parens do not include file and line
numbers for module comments

Add ModuleDeclaration::loc and use it for "Stray paren" ddoc warning.

https://github.com/D-Programming-Language/dmd/commit/23c3c6add8162693f85b3b41c9bf6550a71a57d3
Merge pull request #2291 from 9rnsr/fix4899

Issue 4899 - Ddoc: Warnings about stray parens do not include file and line
numbers for module comments

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 02 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4899


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 02 2013