Skip to content

Passing generate-file-scoped-namespaces results in extra curly brace being added to end of file #555

Open

Description

I've been having this issue for as long as I can remember and I finally decided to track it down and it seems to be manifesting when declaring generate-file-scoped-namespaces.

Here's a pretty "standard" rsp that I use for a pretty simple file here (sokol_log.h)

--config
latest-codegen
single-file
generate-aggressive-inlining
generate-file-scoped-namespaces
log-exclusions
log-potential-typedef-remappings
log-visited-files
generate-cpp-attributes
--additional
-Wno-ignored-attributes
-Wno-nullability-completeness
-Wunused-function

--include-directory
C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/ucrt
./libs/sokol/src/sokol
./libs/sokol/src/
--define-macro
SOKOL_DLL
SOKOL_NO_ENTRY
SOKOL_TRACE_HOOKS
--namespace
Zinc.Internal.Sokol
--libraryPath
sokol

--file
./libs/sokol/src/sokol/sokol_log.h
--methodClassName
Log
--output
./out/src/generated/lib/sokol/Sokol.Log.cs

Here's the corresponding output (notice the extra brace):

using System.Runtime.InteropServices;

namespace Zinc.Internal.Sokol;

public static unsafe partial class Log
{
    [DllImport("sokol", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
    public static extern void slog_func([NativeTypeName("const char *")] sbyte* tag, [NativeTypeName("uint32_t")] uint log_level, [NativeTypeName("uint32_t")] uint log_item, [NativeTypeName("const char *")] sbyte* message, [NativeTypeName("uint32_t")] uint line_nr, [NativeTypeName("const char *")] sbyte* filename, void* user_data);
}
}

And without:

using System.Runtime.InteropServices;

namespace Zinc.Internal.Sokol;

public static unsafe partial class Log
{
    [DllImport("sokol", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
    public static extern void slog_func([NativeTypeName("const char *")] sbyte* tag, [NativeTypeName("uint32_t")] uint log_level, [NativeTypeName("uint32_t")] uint log_item, [NativeTypeName("const char *")] sbyte* message, [NativeTypeName("uint32_t")] uint line_nr, [NativeTypeName("const char *")] sbyte* filename, void* user_data);
}

I'm about to look at the code and see if I can find the bug real quick but logging it here as well just so it's surfaced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions