1

I'm getting a QAC warning 3221 Function declared at block scope.

And the reason that is happening is there's a /A inside the multiline /* */ comment just before the function in the .c file. It is N/A, a "Not Applicable" note.

I can find absolutely nothing on this beyond a normal division operator, or as part of some strange / or /\ construct.

My compiler has no problems, just QAC (and the C parser in the SlickEdit editor!)

In SlickEdit, the /A is white, but returns to blue comment after it.

The A has nothing to do with it as /B and /a and others look the same.

The /A appears white in SlickEdit while the rest of the comment is comment-blue color. I am assuming this is what's related to the QAC warning. The question is why? There is no /(anything) inside such a comment for a thousand lines before.

/*
Function: someFname
Description: N/A In SlickEdit, the slash A is white and this text is back to blue comment color
*/
void someFname(something)
{
     etc.
}
Schwern
  • 153,029
  • 25
  • 195
  • 336
AChimp
  • 19
  • 1
  • 4
    I suggest removing characters until either the problem vanishes or the comment is a lot more minimal than it is now. Can you get away with `/* XX N/A XX */` and see the problem? Then do a hex dump or similar of the file (e.g. `od -c` or `xxd -g 1` or `hd` or …). You may see something to explain what's going on. For example, could there be a `*/` followed by a carriage return and then more data? (That's not probable, but what does it really take to reproduce the problem.) Keep a copy of the original broken file so you can get back to where you started if necessary. – Jonathan Leffler Sep 17 '18 at 22:59
  • 1
    'My compiler has no problems, just QAC (and the C parser in the SlickEdit editor!)' So that would be a slickedit issue then. YOu should retag the question, it will awaken the slickedit watchers – pm100 Sep 17 '18 at 23:07
  • 1
    I bet this is a bug in SlickEdit's code to detect and warn about `/* /* */` (slash-star comments in C do _not_ nest). – zwol Sep 17 '18 at 23:25
  • I'm voting to close this question as off-topic because it is not the programming question. Should not be tagged C as it implies the C programming question. – 0___________ Sep 18 '18 at 00:55
  • Please make a [mcve] of your code, because it is possible that you actually do have that function at block scope, as long as you do not provide more context. – Yunnosch Sep 18 '18 at 06:31
  • It is a programming question if QAC and SlickEdit both are doing the same thing with the /A inside the comment. It isn't related specifically to one or the other. – AChimp Sep 19 '18 at 13:49
  • To reproduce, just create a /* */ multiline comment in SlickEdit in a .c file (so .c parser is used) and see the /A is in white instead of whatever you have selected for the comment color. Again, I strongly suspect this is not a SlickEdit issue but something shared between SlickEdit and QAC because the only 4 functions that QAC reports this on are the only ones with N/A in the comment leading into them. – AChimp Sep 19 '18 at 13:55
  • Ok here are two different comment colors in SlickEdit. With a slash and 2 stars or more (other editors love /************************ opening to a comment) it's dark blue and the /A is white. With a simple /* opening, the whole comment is light blue and the /A is light blue comment color with everything else. /** N/A slash A is white, rest of comment is dark blue */ /* N/A slash A and entire comment is all light blue */ – AChimp Sep 19 '18 at 14:04
  • I'm guessing you can't put code in (Stack Overflow) comments because you can't do carriage returns in comments. Anyway, /* (star)/ is a comment, and in SlickEdit, /*** ***/ is a document comment, which is why they are colored differently. The question is why does /A become white inside a multiline document comment, and whatever that reason is, it is probably what QAC is thinking, too, as only the functions with /A in their header comments are the ones it complains about. – AChimp Sep 19 '18 at 14:26
  • Can you get QAC to produce preprocessed output from its analysis of this file (along with all existing parameters add -pplist+ to the parameters or via file). The output will be named source.c.i and located in the output directory. This will tell you what happens to the mystical /A and proceeding comment stream. You can then run analysis of this .i file as complete standalone, since it will contain all relevant header tokens. – CodeMantle Dec 10 '18 at 23:19

1 Answers1

0

The warning indicates function declared at block scope. This seems unrelated to the / in the comment. I suspect a missing } in the preceding function definition. You should post a minimal but complete source file that exhibits the problem.

On the other hand, SlickEdit might have a display bug for embedded slashes in multiline comments, or might colorize N/A specifically, but it is unlikely to produce a warning.

chqrlie
  • 131,814
  • 10
  • 121
  • 189
  • @Yunnosch: I edited the answer to remove the extra question. this post could have been just a comment, but it should address the OP's interrogations. Let's see if extra information proves me wrong. – chqrlie Sep 18 '18 at 06:39
  • Already checked -- QAC reports 3 other functions have this problem, out of a few dozen, and every single one has N/A inside the comment with the /A as white. So unless there's some phenomenally unlikely coincidence, the QAC choking and the Slick Edit thinking it's some strange escape sequence (that probably stuffs some character back out of the comment into the source code proper stream) suggest they are related. – AChimp Sep 19 '18 at 13:52
  • @AChimp: does the warning go away when you remove the `/`? – chqrlie Sep 19 '18 at 14:48
  • Can't say for sure since the QAC is on a special machine with licensing run by others. I classified it as not an issue because if it were true, the compiler or linker would choke with functions defined inside other function bodies. – AChimp Sep 20 '18 at 18:04
  • I tried playing with the color scheme to see what the /A counted as, but every single white item (using Mocha = black background and dark blue document comments) when I changed to some other color this stayed white. But as I said I doubt the two (strange coloring in SlickEdit and QAC choking) are unrelated because of dozens of functions, only the four with N/A in the comment were tagged by QAC as a problem. If I can just find out what C interpretation rule it is that thinks it is something out of the ordinary when inside a comment. – AChimp Sep 20 '18 at 18:06