corinthia-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Kelly (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COR-41) Use of /* ... */ preferable to //... in STDC Code
Date Fri, 13 Feb 2015 09:37:13 GMT

    [ https://issues.apache.org/jira/browse/COR-41?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14319790#comment-14319790
] 

Peter Kelly commented on COR-41:
--------------------------------

I agree that the code should compile with Wall - however with the exception of warnings that
we know are spurious. There are two such exceptions so far which we set in the compile options
in CMakeLists.txt: C4090 (https://msdn.microsoft.com/en-us/library/k77bkb8d.aspx) and C4996
(https://msdn.microsoft.com/en-us/library/ttcz0bys.aspx). For reference, I looked at the commit
log and found the following:

    Win32: Pass compiler switches from build file
    
    For cases where we disable certain compiler warnings on Windows, do it
    via command-line arguments to the compiler, rather than #pragma
    declarations in the source.
    
    The two specific warnings we disable are:
    
    4090 'function': different 'const'
    
        This is disabled to work around false positives, where VC++
        correctly interprets the semantics of const in pointrs, confusing
        const char ** as something that can't be passed to free(), which we
        do a lot (it's actually valid; its the elements of the array that
        are const, not the array itself).
    
    4996 // The POSIX name for this item is deprecated
    
        Because VC++ wants you to use _strdup instead of strup, and similar
        functions (for some stupid reason)

So perhaps we can add the warning relating to // comments to these as well, and then enable
Wall?

> Use of /* ... */ preferable to //... in STDC Code
> -------------------------------------------------
>
>                 Key: COR-41
>                 URL: https://issues.apache.org/jira/browse/COR-41
>             Project: Corinthia
>          Issue Type: Bug
>    Affects Versions: 0.5
>         Environment: All .c and .h files in the repository
>            Reporter: Dennis E. Hamilton
>            Priority: Trivial
>              Labels: Apache-License-Headers, C
>
> The ASF Notices on .c and .h files use // ... single-line comment triggers instead of
something like 
>    /* ...
>    *
>    ...
>    */
> the only form that some compilers recognize as STDC comments.  The use of -Wall and STDC
compile options will produce warnings in some products, such as most versions of Visual Studio,
clogging the error log with warning messages.
> PROPOSAL:
>  1. Agree that it is OK to change these to /* ... */ when the particular files are touched
for some purpose, such as clearing warnings out of a strict STDC compile.  Enough compilers
warn about this, apparently for down-level STDC compatibility.  
> (In the VC++ standard libraries, there is a file deep in the Windows SDK headers that
has a single //... that annoys me enough to actually fix it in the library.  I'd like to fix
this with some sort of platform quirk patch but I haven't dug enough into the include-path
rules to get that working.  Someday soon ... .) 
>  2. Fix these on an opportunistic basis.  There is no due date but it would be nice that
all new ones be in the universally-STDC form.  (Headers and code files that *require* C++
are another story and they will have different file extensions as well.)
>  3. Pray that rat, the IP checker, recognizes these notices either way.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message