CCAN Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [ccan] New to ccan
@ 2024-05-07 19:54 Ashok Raj
  2024-05-08 23:34 ` Ashok Raj
  0 siblings, 1 reply; 5+ messages in thread
From: Ashok Raj @ 2024-05-07 19:54 UTC (permalink / raw)
  To: ccan

Hi

I'm new to ccan. I'm trying to use just part of the project (just one
module) in another tool. 

I didn't catch the exact method to replicate a single module.

I did take a look at tools/create-ccan-tree. Its not obvious on how to
replicate just bitmap and bitops into my project and generate Makefiles
etc automatically.

If someone has done it and can help please pass the recipe along. 


-- 
Cheers,
Ashok
_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ccan] New to ccan
  2024-05-07 19:54 [ccan] New to ccan Ashok Raj
@ 2024-05-08 23:34 ` Ashok Raj
  2024-06-01  9:23   ` David Gibson
  0 siblings, 1 reply; 5+ messages in thread
From: Ashok Raj @ 2024-05-08 23:34 UTC (permalink / raw)
  To: ccan

On Tue, May 07, 2024 at 12:54:07PM -0700, Ashok Raj wrote:
> Hi
> 
> I'm new to ccan. I'm trying to use just part of the project (just one
> module) in another tool. 
> 
> I didn't catch the exact method to replicate a single module.

So I went past this step and able to include it in my project.

But I see the following warning

[16/247] Compiling C object libccan.a.p/ccan_bitmap_bitmap.c.o
In file included from ../ccan/bitmap/bitmap.c:5:
../ccan/bitmap/bitmap.h: In function bitmap_set_bit:
../ccan/bitmap/bitmap.h:61:43: warning: declaration of bitmap shadows a global declaration [-Wshadow]
   61 | static inline void bitmap_set_bit(bitmap *bitmap, unsigned long n)
      |                                   ~~~~~~~~^~~~~~
../ccan/bitmap/bitmap.h:26:3: note: shadowed declaration is here
   26 | } bitmap;
      |   ^~~~~~


If I were to change the parameter name to _bitmap and in all usages the
warning disappears. Weird the definition its pointing to is this typedewf


/*
 * We wrap each word in a structure for type checking.
 */
typedef struct _bitmap {
	bitmap_word w;
} bitmap;


_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ccan] New to ccan
  2024-05-08 23:34 ` Ashok Raj
@ 2024-06-01  9:23   ` David Gibson
  2024-06-01 12:12     ` Mark Naughton
  2024-06-03  3:56     ` David Gibson
  0 siblings, 2 replies; 5+ messages in thread
From: David Gibson @ 2024-06-01  9:23 UTC (permalink / raw)
  To: Ashok Raj; +Cc: ccan


[-- Attachment #1.1: Type: text/plain, Size: 2049 bytes --]

On Wed, May 08, 2024 at 04:34:10PM -0700, Ashok Raj wrote:
> On Tue, May 07, 2024 at 12:54:07PM -0700, Ashok Raj wrote:
> > Hi
> > 
> > I'm new to ccan. I'm trying to use just part of the project (just one
> > module) in another tool. 
> > 
> > I didn't catch the exact method to replicate a single module.

As I recall, we talked about this a bit, but never did come up with a
great method.

> So I went past this step and able to include it in my project.
> 
> But I see the following warning
> 
> [16/247] Compiling C object libccan.a.p/ccan_bitmap_bitmap.c.o
> In file included from ../ccan/bitmap/bitmap.c:5:
> ../ccan/bitmap/bitmap.h: In function bitmap_set_bit:
> ../ccan/bitmap/bitmap.h:61:43: warning: declaration of bitmap shadows a global declaration [-Wshadow]
>    61 | static inline void bitmap_set_bit(bitmap *bitmap, unsigned long n)
>       |                                   ~~~~~~~~^~~~~~
> ../ccan/bitmap/bitmap.h:26:3: note: shadowed declaration is here
>    26 | } bitmap;
>       |   ^~~~~~
> 
> 
> If I were to change the parameter name to _bitmap and in all usages the
> warning disappears. Weird the definition its pointing to is this
> typedewf

Huh.  Looks like the code is relying on types and variables/parameters
being in different namespaces, but that warning doesn't like that.  I
guess we must not have had the relevant warning enabled before.

I made a fix, but it's been so long since I pushed things to the ccan
repo, I've forgotten how and will have to figure it out again.

Speaking of which... ccan is largely moribund at this point.  Neither
Rusty nor I has any real time to devote to it.  And in my case,
collecting C examples - even very nice ones - has become a lot
compelling with the emergence of viable alternative systems
programming languages (Rust, Go, Zig).

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ccan] New to ccan
  2024-06-01  9:23   ` David Gibson
@ 2024-06-01 12:12     ` Mark Naughton
  2024-06-03  3:56     ` David Gibson
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Naughton @ 2024-06-01 12:12 UTC (permalink / raw)
  To: David Gibson; +Cc: ccan

Most of the ccan modules are relatively self-contatined, they can easily
be integrated into your project just by changing the relevant include
paths.

I have noticed Google search has gotten far worse at finding all of the
hidden-gem C libraries out there, so really websites like ccan are more
useful than ever.
_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ccan] New to ccan
  2024-06-01  9:23   ` David Gibson
  2024-06-01 12:12     ` Mark Naughton
@ 2024-06-03  3:56     ` David Gibson
  1 sibling, 0 replies; 5+ messages in thread
From: David Gibson @ 2024-06-03  3:56 UTC (permalink / raw)
  To: Ashok Raj; +Cc: ccan


[-- Attachment #1.1: Type: text/plain, Size: 1971 bytes --]

On Sat, Jun 01, 2024 at 07:23:07PM +1000, David Gibson wrote:
> On Wed, May 08, 2024 at 04:34:10PM -0700, Ashok Raj wrote:
> > On Tue, May 07, 2024 at 12:54:07PM -0700, Ashok Raj wrote:
> > > Hi
> > > 
> > > I'm new to ccan. I'm trying to use just part of the project (just one
> > > module) in another tool. 
> > > 
> > > I didn't catch the exact method to replicate a single module.
> 
> As I recall, we talked about this a bit, but never did come up with a
> great method.
> 
> > So I went past this step and able to include it in my project.
> > 
> > But I see the following warning
> > 
> > [16/247] Compiling C object libccan.a.p/ccan_bitmap_bitmap.c.o
> > In file included from ../ccan/bitmap/bitmap.c:5:
> > ../ccan/bitmap/bitmap.h: In function bitmap_set_bit:
> > ../ccan/bitmap/bitmap.h:61:43: warning: declaration of bitmap shadows a global declaration [-Wshadow]
> >    61 | static inline void bitmap_set_bit(bitmap *bitmap, unsigned long n)
> >       |                                   ~~~~~~~~^~~~~~
> > ../ccan/bitmap/bitmap.h:26:3: note: shadowed declaration is here
> >    26 | } bitmap;
> >       |   ^~~~~~
> > 
> > 
> > If I were to change the parameter name to _bitmap and in all usages the
> > warning disappears. Weird the definition its pointing to is this
> > typedewf
> 
> Huh.  Looks like the code is relying on types and variables/parameters
> being in different namespaces, but that warning doesn't like that.  I
> guess we must not have had the relevant warning enabled before.
> 
> I made a fix, but it's been so long since I pushed things to the ccan
> repo, I've forgotten how and will have to figure it out again.

Ok, I figured it out.  Fix is now pushed to https://github.com/rustyrussell/ccan.git

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-03  4:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-07 19:54 [ccan] New to ccan Ashok Raj
2024-05-08 23:34 ` Ashok Raj
2024-06-01  9:23   ` David Gibson
2024-06-01 12:12     ` Mark Naughton
2024-06-03  3:56     ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox