That line works for me with gnu make 4.4.1.

What version are you using and what's the EXACT output and FULL
makefile that you see a problem with?


Philip Guenther

On Sat, Nov 7, 2026 at 9:46 PM DeDf <[email protected]> wrote:
>
> I found a bug regarding inline comments. When adding an inline comment # 
> after an = assignment statement, if there is some space before the #, 
> compilation fails.
>
> If a makefile contains the following statements:
> TARGET = output
> This line works fine.
>
> TARGET = output    # test
> This line reports an error.
>
> Suggested fix:
> read.c remove_comments():
>
> static void
> remove_comments (char *line)
> {
>     if (line)
>     {
>         char *comment = find_map_unquote (line, MAP_COMMENT|MAP_VARIABLE);
>         if (comment)
>         {
>             //char b = 0;
>             *comment = '\0';  /* Cut off the line at the #.  */
>
>             while (comment != line)
>             {
>                 if (--comment == line)
>                     break;
>
>                 if (*comment == ' ' || *comment == '\t')  // Remove ' ' and 
> '\t' before comment.
>                 {
> //                     if (!b)
> //                     {
> //                         printf("remove_comments() |%s|\n", line);
> //                         b = 1;
> //                     }
>
>                     *comment = '\0';
>                 }
>                 else
>                     break;
>             }
>         }
>     }
> }
>
> Thanks,
> form DeDf

Reply via email to